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

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface2: #f0f1f5;
  --border: #e0e2ea;
  --text: #2d3142;
  --text2: #6b7084;
  --primary: #6c5ce7;
  --primary-hover: #5a4bd6;
  --success: #00b894;
  --danger: #e74c3c;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-hover: 0 4px 12px rgba(108,92,231,0.15);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* Header */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logo-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: contain;
}

.logo span { color: var(--primary); }

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.3rem;
}

.nav {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

/* Mega dropdown */
.mega { position: static; }

.mega-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-family: inherit;
  position: relative;
}

.mega-btn::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 0.35rem;
  vertical-align: 0.1em;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  transition: transform 0.2s;
}

.mega-btn.active::after {
  transform: rotate(180deg);
}

.mega-btn:hover,
.mega-btn.active {
  background: var(--surface2);
  color: var(--primary);
}

.mega-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,0.10);
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: center;
  gap: 3rem;
  z-index: 1000;
  animation: megaSlideDown 0.15s ease-out;
}

@keyframes megaSlideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mega-panel[hidden] { display: none; }

.mega-col { min-width: 150px; }

.mega-col h4 {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text2);
  margin: 0 0 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--primary);
}

.mega-col a {
  display: block;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.mega-col a:hover {
  background: var(--surface2);
  color: var(--primary);
}

/* Main */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.subtitle {
  color: var(--text2);
  font-size: 1.05rem;
  margin-bottom: 2rem;
}

/* Section Titles */
.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 2rem 0 0;
  color: var(--text);
}

/* Tool Cards on Home */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.2rem;
  margin: 2rem 0;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  display: block;
  box-shadow: var(--shadow);
}

.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.tool-card .icon {
  font-size: 2rem;
  margin-bottom: 0.8rem;
}

.tool-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
}

.tool-card p {
  color: var(--text2);
  font-size: 0.85rem;
}

/* Upload Area */
.upload-area {
  background: var(--surface);
  border: 2px dashed #c5c8d6;
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.3s, background 0.3s;
  margin: 1.5rem 0;
  box-shadow: var(--shadow);
}

.upload-area:hover, .upload-area.drag-over {
  border-color: var(--primary);
  background: #f0eeff;
}

.upload-area .icon { font-size: 3rem; margin-bottom: 1rem; }
.upload-area p { color: var(--text2); }
.upload-area .browse { color: var(--primary); font-weight: 600; }

/* Options */
.options {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.options label {
  color: var(--text2);
  font-size: 0.9rem;
}

.options select, .options input[type="range"] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.5rem 0.8rem;
  font-size: 0.9rem;
}

.options select { cursor: pointer; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

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

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover { background: var(--primary-hover); color: white; }

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Text Areas */
.textarea-wrap {
  position: relative;
  margin: 1rem 0;
}

textarea {
  width: 100%;
  min-height: 250px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 1rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  resize: vertical;
  line-height: 1.5;
  box-shadow: var(--shadow);
}

textarea:focus {
  outline: none;
  border-color: var(--primary);
}

/* Result */
.result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1rem 0;
  display: none;
  box-shadow: var(--shadow);
}

.result.visible { display: block; }

.result .stats {
  display: flex;
  gap: 2rem;
  margin-bottom: 1rem;
}

.result .stat-label {
  color: var(--text2);
  font-size: 0.8rem;
}

.result .stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--success);
}

/* Progress */
.progress {
  height: 4px;
  background: var(--surface2);
  border-radius: 2px;
  overflow: hidden;
  margin: 1rem 0;
  display: none;
}

.progress.active { display: block; }

.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  width: 0;
  transition: width 0.3s;
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text2);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  margin-top: 4rem;
}

/* SEO Content */
.seo-content {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.seo-content h2 {
  font-size: 1.3rem;
  margin-bottom: 0.8rem;
  color: var(--text);
}

.seo-content p, .seo-content li {
  color: var(--text2);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.seo-content ul { padding-left: 1.5rem; }

/* Cookie banner */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  z-index: 9999;
  animation: slideUp 0.3s ease-out;
}

.cookie-banner[hidden] { display: none; }

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.cookie-banner p {
  font-size: 0.85rem;
  color: var(--text2);
  margin: 0;
  flex: 1;
}

.cookie-banner a {
  color: var(--primary);
  font-weight: 600;
}

.cookie-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.cookie-actions .btn {
  padding: 0.5rem 1.2rem;
  font-size: 0.85rem;
}

@media (max-width: 768px) {
  .cookie-banner {
    flex-direction: column;
    text-align: center;
    padding: 1rem;
    gap: 0.75rem;
  }
}

/* Ad placeholder */
.ad-slot {
  background: var(--surface);
  border: 1px dashed #d0d3de;
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  color: var(--text2);
  font-size: 0.8rem;
  margin: 1.5rem 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Responsive */
@media (max-width: 768px) {
  .header { padding: 1rem; }
  .menu-toggle { display: block; }
  .nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    padding: 0.5rem;
    gap: 0;
    z-index: 99;
  }
  .nav.open { display: flex; }
  .mega-btn {
    width: 100%;
    text-align: left;
    padding: 0.7rem 1rem;
    border-radius: 0;
    font-size: 1rem;
  }
  .mega-btn::after { margin-left: auto; }
  .mega-panel {
    position: static;
    flex-direction: column;
    gap: 0.75rem;
    border: none;
    border-top: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0.5rem 1rem 0.75rem 1.5rem;
    animation: none;
    background: var(--surface2);
    justify-content: flex-start;
  }
  .mega-col { min-width: 0; }
  h1 { font-size: 1.5rem; }
  .container { padding: 1.5rem 1rem; }
  .tools-grid { grid-template-columns: 1fr; }
  .options { flex-direction: column; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Hash generator */
.hash-results { display: flex; flex-direction: column; gap: 0.8rem; }

.hash-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.hash-label {
  min-width: 65px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text2);
}

.hash-output {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.5rem 0.7rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.78rem;
}

.copy-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text2);
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.2s, color 0.2s;
}

.copy-btn:hover { background: var(--primary); color: white; }

/* Stats grid (word counter) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-name {
  color: var(--text2);
  font-size: 0.85rem;
  margin-top: 0.3rem;
}

/* JSON / textarea side-by-side responsive */
@media (max-width: 768px) {
  div[style*="grid-template-columns: 1fr 1fr"] {
    display: block !important;
  }
  .hash-row { flex-wrap: wrap; }
  .hash-label { min-width: 100%; }
}
