/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --red: #BC002D;
  --black: #111111;
  --white: #ffffff;
  --border: #e8e8e8;
  --muted: rgba(17,17,17,0.4);
}
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: Arial, sans-serif; color: var(--black); background: var(--white); min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { font-family: Arial, sans-serif; cursor: pointer; }

/* ── Nav ── */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 56px; position: sticky; top: 0; z-index: 100;
  background: var(--white); border-bottom: 1px solid var(--border);
}
.logo { font-size: 20px; font-weight: 700; color: var(--black); }
.logo span { color: var(--red); }
.nav-links { display: flex; gap: 20px; align-items: center; list-style: none; }
.nav-links a { font-size: 14px; font-weight: 600; color: var(--black); transition: color 0.15s; }
.nav-links a:hover, .nav-links a.active { color: var(--red); }
.nav-cta { background: var(--red); color: var(--white) !important; padding: 7px 16px; border-radius: 4px; font-size: 13px !important; text-transform: uppercase; letter-spacing: 0.05em; }
.nav-cta:hover { background: #8f0020 !important; }
.nav-account { border: 1.5px solid var(--black); padding: 5px 14px; border-radius: 4px; font-size: 13px !important; }
.nav-burger { display: none; flex-direction: column; gap: 5px; background: none; border: none; padding: 4px; }
.nav-burger span { display: block; width: 22px; height: 2px; background: var(--black); transition: transform 0.2s; }
.nav-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-mobile {
  display: none; flex-direction: column;
  position: fixed; top: 56px; left: 0; right: 0; bottom: 0;
  background: var(--white); z-index: 99;
  padding: 24px; gap: 0;
}
.nav-mobile.open { display: flex; }
.nav-mobile a { font-size: 22px; font-weight: 700; color: var(--black); padding: 16px 0; border-bottom: 1px solid var(--border); }
.nav-mobile a.nav-cta { border: none; color: var(--red) !important; background: none; }

@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-burger { display: flex; }
}

/* ── Hero ── */
.hero { text-align: center; padding: 40px 20px 24px; border-bottom: 1px solid var(--border); }
.hero-jp { font-size: 12px; color: var(--red); letter-spacing: 0.2em; margin-bottom: 10px; font-weight: 700; text-transform: uppercase; }
.hero h1 { font-size: clamp(28px, 6vw, 44px); font-weight: 700; color: var(--black); margin-bottom: 6px; line-height: 1.15; }
.hero h1 em { font-style: normal; color: var(--red); }
.hero-sub { font-size: 15px; color: var(--black); }

/* ── Controls ── */
.controls { display: flex; justify-content: center; align-items: center; padding: 16px 20px; gap: 20px; flex-wrap: wrap; }
.polite-label { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; color: var(--black); cursor: pointer; text-transform: uppercase; letter-spacing: 0.06em; user-select: none; }
.polite-label input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--red); cursor: pointer; }

/* ── Translator boxes ── */
.main { max-width: 980px; margin: 0 auto; padding: 0 16px 24px; }
.boxes { display: flex; flex-direction: column; gap: 16px; }
@media(min-width: 640px) {
  .boxes { flex-direction: row; gap: 0; align-items: stretch; }
  .box.in { border-right: none; border-radius: 10px 0 0 10px; }
  .box.out { border-radius: 0 10px 10px 0; }
}

.box { flex: 1; display: flex; flex-direction: column; background: var(--white); border: 1.5px solid var(--border); border-radius: 10px; overflow: hidden; }
@media(max-width: 639px) {
  .box.out { border-top: 2px solid var(--red); }
}

.box-head { padding: 14px 18px; background: var(--white); border-bottom: 1.5px solid var(--border); display: flex; align-items: center; justify-content: space-between; min-height: 60px; }
.flags { font-size: 28px; line-height: 1; letter-spacing: 3px; }

.box textarea {
  flex: 1; border: none; outline: none; resize: none; padding: 20px;
  font-family: Arial, sans-serif; font-size: clamp(22px, 4vw, 30px);
  font-weight: 400; color: var(--black); background: var(--white);
  line-height: 1.5; min-height: 190px; width: 100%;
}
.box textarea::placeholder { color: #ccc; }

.box-foot { padding: 10px 16px; border-top: 1.5px solid var(--border); display: flex; align-items: center; justify-content: space-between; min-height: 46px; background: var(--white); }
.wc { font-size: 13px; font-weight: 700; color: var(--black); }
.wc.limit { color: var(--red); }

/* ── Output area ── */
.out-area { flex: 1; padding: 20px; display: flex; flex-direction: column; gap: 10px; position: relative; background: var(--white); min-height: 190px; }
.out-jp { font-size: clamp(24px, 5vw, 36px); color: var(--black); line-height: 1.5; font-weight: 700; }
.out-en { font-size: clamp(22px, 4vw, 30px); color: var(--black); line-height: 1.5; font-weight: 400; }
.out-rom { font-size: 17px; color: var(--red); font-weight: 700; letter-spacing: 0.04em; margin-top: 4px; }
.out-meaning { font-size: 14px; color: var(--black); opacity: 0.5; margin-top: 2px; }
.out-limit { font-size: 15px; font-weight: 700; color: var(--red); }
.out-limit a { color: var(--red); text-decoration: underline; }

/* ── Spinner ── */
.spinner { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: var(--white); }
.spinner.on { display: flex; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); animation: p 1.2s ease-in-out infinite; }
.dot:nth-child(2){ animation-delay:.2s; margin:0 8px; }
.dot:nth-child(3){ animation-delay:.4s; }
@keyframes p{0%,80%,100%{transform:scale(0.5);opacity:0.3}40%{transform:scale(1);opacity:1}}

/* ── Swap button ── */
.swap-wrap { display: flex; align-items: center; justify-content: center; padding: 8px 0; }
@media(min-width:640px){ .swap-wrap { flex-shrink:0; width:52px; padding:0; align-self:center; } }
.swap-btn { width: 40px; height: 40px; border: 1.5px solid var(--border); border-radius: 50%; background: var(--white); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.2s, transform 0.25s; }
.swap-btn:hover { background: var(--red); border-color: var(--red); transform: rotate(180deg); }
.swap-btn svg { width: 17px; height: 17px; stroke: var(--black); }
.swap-btn:hover svg { stroke: var(--white); }

/* ── Audio button ── */
.audio-btn { width: 34px; height: 34px; border: 1.5px solid var(--border); border-radius: 50%; background: var(--white); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.15s; }
.audio-btn:hover { background: var(--red); border-color: var(--red); }
.audio-btn svg { width: 15px; height: 15px; stroke: var(--black); }
.audio-btn:hover svg { stroke: var(--white); }

/* ── Usage bar ── */
.usage { max-width: 980px; margin: 0 auto; padding: 8px 16px 28px; display: flex; align-items: center; gap: 14px; }
.track { flex:1; height:2px; background: var(--border); border-radius:2px; overflow:hidden; }
.fill  { height:100%; background: var(--red); border-radius:2px; transition:width .3s; }
.usage-txt { font-size: 12px; font-weight: 700; color: var(--black); white-space: nowrap; }
.upgrade { font-size: 12px; color: var(--red); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }

/* ── Footer ── */
.footer { border-top: 1px solid var(--border); padding: 32px 24px; margin-top: 40px; }
.footer-inner { max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.footer-logo { font-size: 18px; font-weight: 700; color: var(--black); }
.footer-logo span { color: var(--red); }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; }
.footer-links a { font-size: 13px; color: var(--black); font-weight: 600; }
.footer-links a:hover { color: var(--red); }
.footer-copy { font-size: 12px; color: var(--black); opacity: 0.4; }

/* ── Generic page ── */
.page { max-width: 700px; margin: 48px auto; padding: 0 20px 60px; }
.page h1 { font-size: clamp(26px, 5vw, 38px); font-weight: 700; margin-bottom: 16px; }
.page h2 { font-size: 20px; font-weight: 700; margin: 28px 0 10px; }
.page p { font-size: 16px; line-height: 1.7; margin-bottom: 14px; }
.page a { color: var(--red); font-weight: 700; }

/* ── Forms ── */
.form-wrap { max-width: 440px; margin: 48px auto; padding: 0 20px 60px; }
.form-wrap h1 { font-size: 28px; font-weight: 700; margin-bottom: 24px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; color: var(--black); }
.field input, .field textarea, .field select {
  width: 100%; padding: 13px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  font-family: Arial, sans-serif; font-size: 16px; color: var(--black);
  background: var(--white); outline: none; transition: border-color 0.2s;
}
.field input:focus, .field textarea:focus { border-color: var(--red); }
.field textarea { min-height: 120px; resize: vertical; }
.btn { width: 100%; background: var(--red); color: var(--white); border: none; border-radius: 8px; padding: 14px; font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; cursor: pointer; transition: background 0.2s; }
.btn:hover { background: #8f0020; }
.btn-outline { background: var(--white); color: var(--black); border: 1.5px solid var(--black); }
.btn-outline:hover { background: var(--black); color: var(--white); }
.form-note { font-size: 13px; color: var(--black); opacity: 0.5; text-align: center; margin-top: 16px; }
.form-note a { color: var(--red); opacity: 1; font-weight: 700; }
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; font-weight: 700; margin-bottom: 16px; }
.alert-error { background: #fff0f3; color: var(--red); border: 1px solid var(--red); }
.alert-success { background: #f0fff4; color: #007a33; border: 1px solid #007a33; }

/* ── Account dashboard ── */
.account-wrap { max-width: 700px; margin: 40px auto; padding: 0 20px 60px; }
.account-card { border: 1.5px solid var(--border); border-radius: 10px; padding: 24px; margin-bottom: 20px; }
.account-card h2 { font-size: 16px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 16px; }
.plan-badge { display: inline-block; background: var(--red); color: var(--white); padding: 4px 12px; border-radius: 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.stat-row:last-child { border-bottom: none; }
.stat-val { font-weight: 700; }
