* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  color: #1a1a2e;
  background: #f0f2f5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: white;
  padding: 40px 0;
  text-align: center;
}

.logo {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.tagline {
  font-size: 1.1rem;
  opacity: 0.8;
}

/* Tools Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  padding: 40px 0;
}

.tool-card {
  background: white;
  border-radius: 12px;
  padding: 28px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.tool-icon {
  font-size: 1.4rem;
  font-weight: 700;
  color: #4361ee;
  background: #eef1ff;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.tool-card h2 {
  font-size: 1.15rem;
  margin-bottom: 6px;
}

.tool-card p {
  font-size: 0.9rem;
  color: #666;
}

/* Footer */
.footer {
  background: #1a1a2e;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  padding: 20px 0;
  margin-top: 40px;
  font-size: 0.85rem;
}

/* ===== Tool Page Layout ===== */
.tool-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px;
}

.tool-page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.back-link {
  color: #4361ee;
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}

.back-link:hover {
  text-decoration: underline;
}

.tool-page-header h1 {
  font-size: 1.5rem;
}

/* Common Form Elements */
textarea, input[type="text"], input[type="number"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
}

textarea:focus, input:focus {
  outline: none;
  border-color: #4361ee;
}

textarea {
  min-height: 160px;
}

.btn-group {
  display: flex;
  gap: 10px;
  margin: 16px 0;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: #4361ee;
  color: white;
}

.btn-primary:hover {
  background: #3a56d4;
}

.btn-secondary {
  background: #e8eaf6;
  color: #1a1a2e;
}

.btn-secondary:hover {
  background: #d0d3f0;
}

.result-box {
  background: #f8f9fa;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 16px;
  min-height: 100px;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Split View (editor + preview) */
.split-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 768px) {
  .split-view {
    grid-template-columns: 1fr;
  }
  .tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
  }
  .logo {
    font-size: 2rem;
  }
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1a1a2e;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  z-index: 9999;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Tool Navigation */
.tool-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  margin-top: 40px;
  border-top: 1px solid #e0e0e0;
  gap: 12px;
}

.tool-nav a {
  padding: 8px 16px;
  background: #e8eaf6;
  color: #4361ee;
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.9rem;
  white-space: nowrap;
  transition: background 0.2s;
}

.tool-nav a:hover {
  background: #d0d3f0;
}

.tool-nav .nav-label {
  font-size: 0.75rem;
  color: #888;
}
