:root {
  --black: #181818;
  --dark: #121212;
  --card-bg: #1e1e1e;
  --lime: #B6FF00;
  --lime-dim: rgba(182, 255, 0, 0.7);
  --lime-bg: rgba(182, 255, 0, 0.05);
  --lime-bg-hover: rgba(182, 255, 0, 0.12);
  --text: #ffffff;
  --text-muted: #a0a0a0;
  --text-dim: #666666;
  --border: #2a2a2a;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --radius: 20px;
  --radius-sm: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--dark);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

.font-jp { font-family: 'Noto Sans JP', sans-serif; }

.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* NAVBAR */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--dark);
  border-bottom: 2px solid var(--lime);
}

.nav-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.5rem;
  max-width: 1320px;
  margin: 0 auto;
}

.logo {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--lime);
  text-decoration: none;
  letter-spacing: -0.02em;
}

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

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

.nav-desktop a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.15s;
  white-space: nowrap;
}

.nav-desktop a:hover,
.nav-desktop a.active { color: var(--lime); }

/* HAMBURGER */
.hamburger {
  display: none;
  background: none;
  border: 2px solid var(--lime);
  color: var(--lime);
  cursor: pointer;
  padding: 0.45rem;
  border-radius: 8px;
  transition: all 0.15s;
}

.hamburger:hover {
  background: var(--lime);
  color: var(--black);
}

.hamburger .bar {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  margin: 4px auto;
  transition: all 0.25s;
  border-radius: 1px;
}

.hamburger.active .bar:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}

.hamburger.active .bar:nth-child(2) {
  opacity: 0;
}

.hamburger.active .bar:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
}

/* MOBILE MENU */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 90;
}

.mobile-overlay.open { display: block; }

.mobile-menu {
  position: fixed;
  top: 0;
  right: -280px;
  width: 260px;
  height: 100vh;
  background: var(--card-bg);
  z-index: 95;
  transition: right 0.25s ease;
  padding: 5rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
}

.mobile-menu.open { right: 0; }

.mobile-menu a {
  display: block;
  color: var(--text);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  transition: color 0.15s;
}

.mobile-menu a:hover,
.mobile-menu a.active { color: var(--lime); }

.mobile-menu .menu-footer {
  margin-top: auto;
  padding-top: 2rem;
  color: var(--text-dim);
  font-size: 0.75rem;
  text-align: center;
}

/* HERO */
.hero {
  padding: 6.5rem 1.5rem 3.5rem;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  padding: 0.45rem 1rem;
  background: var(--lime);
  color: var(--black);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hero h1 {
  font-size: clamp(1.75rem, 5vw, 3.25rem);
  font-weight: 900;
  color: var(--text);
  margin-bottom: 1rem;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.hero h1 em {
  font-style: normal;
  color: var(--lime);
}

.hero p {
  color: var(--text-muted);
  font-size: clamp(0.9rem, 2.5vw, 1.05rem);
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.875rem;
  text-decoration: none;
  transition: all 0.15s;
  cursor: pointer;
  border: 2px solid transparent;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--lime);
  color: var(--black);
  border-color: var(--lime);
}

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

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--text);
}

.btn-secondary:hover {
  background: var(--text);
  color: var(--black);
}

.btn-lime-outline {
  background: transparent;
  color: var(--lime);
  border: 2px solid var(--lime);
}

.btn-lime-outline:hover {
  background: var(--lime);
  color: var(--black);
}

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

.btn-block {
  width: 100%;
  padding: 0.95rem;
  font-size: 0.95rem;
}

/* CARDS */
.card {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

/* SECTION */
.section {
  padding: 3rem 1.5rem;
}

.section-title {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 900;
  margin-bottom: 0.5rem;
  letter-spacing: -0.03em;
  text-align: center;
}

.section-subtitle {
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 2.5rem;
  font-size: clamp(0.85rem, 2.5vw, 1.05rem);
  line-height: 1.7;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid-3 {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* KANA GROUP */
.kana-group {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.kana-group-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--lime);
  margin-bottom: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 0.5rem;
}

.char-card {
  background: var(--dark);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.35rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.char-card:hover,
.char-card:active {
  border-color: var(--lime);
  background: var(--lime-bg);
  transform: scale(1.05);
}

.char-card .char {
  font-size: clamp(1.15rem, 3vw, 1.65rem);
  font-weight: 700;
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--text);
  line-height: 1.15;
  margin-bottom: 0.15rem;
}

.char-card .romaji {
  font-size: 0.65rem;
  color: var(--lime);
  font-weight: 600;
}

/* KANJI */
.kanji-card {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 0.75rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.kanji-card:hover,
.kanji-card:active {
  border-color: var(--lime);
  transform: translateY(-3px);
}

.kanji-card .kanji {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--lime);
  margin-bottom: 0.35rem;
  line-height: 1.2;
}

.kanji-card .reading {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  font-family: 'Noto Sans JP', sans-serif;
}

.kanji-card .meaning {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* INPUTS */
.input-group {
  margin-bottom: 1rem;
}

.input-group label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

textarea,
input,
select {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--dark);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.15s;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}

textarea:focus,
input:focus,
select:focus {
  outline: none;
  border-color: var(--lime);
}

textarea { resize: vertical; min-height: 100px; }
select { cursor: pointer; }

.select-wrapper {
  position: relative;
}

.select-wrapper::after {
  content: '▾';
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--lime);
  pointer-events: none;
  font-size: 0.85rem;
}

/* TABS */
.tab-row {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.tab-row::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  border: 2px solid var(--border);
  background: transparent;
  color: var(--text-muted);
}

.tab-btn.active {
  background: var(--lime);
  color: var(--black);
  border-color: var(--lime);
}

.tab-btn:not(.active):hover {
  border-color: var(--lime);
  color: var(--lime);
}

/* RESULTS */
.result-box {
  background: var(--dark);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.15rem;
  margin-bottom: 0.85rem;
}

.result-box:last-child { margin-bottom: 0; }

.result-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
  font-weight: 700;
}

.result-content {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.55;
}

.result-content.japanese {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  color: var(--lime);
}

.result-content.romaji {
  color: var(--lime-dim);
  font-style: italic;
}

/* PHRASE CARDS */
.phrase-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.phrase-jp {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--lime);
  margin-bottom: 0.25rem;
  font-weight: 600;
  line-height: 1.4;
}

.phrase-card-lime {
  background: var(--lime);
  border-color: var(--lime);
}

.phrase-card-lime .phrase-jp { color: var(--black); }
.phrase-card-lime .phrase-romaji { color: rgba(0,0,0,0.55); }
.phrase-card-lime .phrase-translations { border-top-color: rgba(0,0,0,0.12); }
.phrase-card-lime .phrase-en { color: rgba(0,0,0,0.7); }
.phrase-card-lime .phrase-id { color: rgba(0,0,0,0.5); }

.phrase-romaji {
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 0.65rem;
  font-size: 0.85rem;
}

.phrase-translations {
  padding-top: 0.75rem;
  border-top: 2px solid var(--border);
}

.phrase-en {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0.15rem;
}

.phrase-id {
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* FOOTER */
.footer {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.75rem;
}

/* UTIL */
.hidden { display: none !important; }

.loading-spinner {
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid rgba(182, 255, 0, 0.2);
  border-top-color: var(--lime);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-text {
  color: var(--error);
  font-size: 0.8rem;
  margin-top: 1rem;
  padding: 0.7rem 1rem;
  background: rgba(239, 68, 68, 0.08);
  border: 2px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  word-break: break-word;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .nav-desktop { display: none; }
  .hamburger { display: block; }
  .container { padding: 0 1rem; }
  .section { padding: 2.5rem 1rem; }
  .hero { padding: 5.5rem 1rem 2.5rem; }
  .nav-content { padding: 0.75rem 1rem; }

  .hero-actions {
    flex-direction: column;
    align-items: center;
    max-width: 300px;
    margin: 0 auto;
  }

  .char-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 0.4rem;
  }

  .char-card { padding: 0.65rem 0.25rem; }
  .kana-group { padding: 1rem; }
  .card { padding: 1.25rem; }
  .phrase-card { padding: 1.25rem; }
  .kanji-card { padding: 1.25rem 0.75rem; }

  .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.65rem; }
  .section-title { font-size: 1.5rem; }
  .hero { padding: 5rem 0.75rem 2rem; }
  .section { padding: 2rem 0.75rem; }
  .container { padding: 0 0.75rem; }
  .char-grid { grid-template-columns: repeat(5, 1fr); }
  .kanji-card { padding: 1rem 0.5rem; }
  .result-box { padding: 0.85rem 1rem; }
}
