@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Unbounded:wght@600;700&display=swap");

:root {
  color-scheme: dark;
  --bg: #08090d;
  --panel: rgba(20, 21, 29, 0.88);
  --line: rgba(255, 255, 255, 0.09);
  --muted: #8f909b;
  --text: #f7f5ff;
  --violet: #8d74ff;
  --mint: #65e1bf;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", sans-serif;
  margin: 0;
  overflow-x: hidden;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; font: inherit; }
[hidden] { display: none !important; }

.ambient {
  border-radius: 50%;
  filter: blur(80px);
  opacity: .28;
  pointer-events: none;
  position: fixed;
}

.ambient-one { background: #7150ff; height: 320px; left: -160px; top: -100px; width: 320px; }
.ambient-two { background: #1d826d; bottom: -180px; height: 340px; right: -180px; width: 340px; }

.app-shell {
  margin: 0 auto;
  max-width: 560px;
  min-height: 100dvh;
  padding: max(18px, env(safe-area-inset-top)) 18px calc(92px + env(safe-area-inset-bottom));
  position: relative;
}

.topbar { align-items: center; display: flex; justify-content: space-between; }
.brand { align-items: center; background: transparent; border: 0; color: var(--text); cursor: pointer; display: flex; font-family: "Unbounded", sans-serif; font-size: 14px; gap: 10px; letter-spacing: .08em; padding: 0; text-decoration: none; }
.brand-mark { align-items: center; background: linear-gradient(145deg, var(--violet), #6042d8); border-radius: 11px; box-shadow: 0 8px 26px rgba(117, 84, 255, .38); display: flex; height: 34px; justify-content: center; width: 34px; }
.streak { background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 999px; color: #d8d4e7; font-size: 12px; font-weight: 700; padding: 8px 12px; }
.streak span { color: #ffbd5f; margin-right: 4px; }

.progress-panel { background: rgba(18,19,25,.62); border: 1px solid var(--line); border-radius: 22px; display: grid; gap: 14px; grid-template-columns: 1fr 1fr; margin-top: 24px; padding: 18px; }
.eyebrow { color: var(--muted); display: block; font-size: 9px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.progress-panel strong { display: block; font-size: 28px; margin-top: 3px; }
.progress-panel strong small { color: #71727b; font-size: 15px; }
.progress-copy { align-self: end; color: #aaa9b3; font-size: 11px; line-height: 1.5; text-align: right; }
.progress-copy span { display: block; }
.progress-track { background: rgba(255,255,255,.07); border-radius: 99px; grid-column: 1 / -1; height: 4px; overflow: hidden; }
.progress-track i { background: linear-gradient(90deg, var(--violet), var(--mint)); border-radius: inherit; display: block; height: 100%; transition: width .45s ease; }

.review-stage { margin-top: 18px; perspective: 1000px; }
.review-card { background: radial-gradient(circle at 80% 0%, rgba(113,80,255,.17), transparent 35%), linear-gradient(160deg, rgba(27,27,38,.98), rgba(13,14,19,.98)); border: 1px solid rgba(207,199,255,.13); border-radius: 30px; box-shadow: 0 30px 80px rgba(0,0,0,.4); min-height: 550px; padding: 25px; position: relative; transition: transform .25s ease, border-color .25s ease; }
.review-card.revealed { border-color: rgba(141,116,255,.34); transform: translateY(-2px); }
.card-topline { align-items: center; display: flex; justify-content: space-between; }
.source-pill { align-items: center; color: #aaa8b6; display: flex; font-size: 10px; font-weight: 700; gap: 7px; max-width: 75%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-pill i { background: var(--mint); border-radius: 50%; box-shadow: 0 0 14px rgba(101,225,191,.75); height: 6px; width: 6px; }
.source-pill { text-decoration: none; }
.source-pill.disabled { pointer-events: none; }
.icon-button { background: rgba(255,255,255,.055); border: 1px solid var(--line); border-radius: 50%; cursor: pointer; font-size: 22px; height: 40px; transform: rotate(-25deg); width: 40px; }
.word-block { margin-top: 56px; }
.word-kind { background: rgba(141,116,255,.14); border: 1px solid rgba(141,116,255,.25); border-radius: 99px; color: #b8aaff; display: inline-block; font-size: 9px; font-weight: 800; letter-spacing: .08em; padding: 6px 9px; text-transform: uppercase; }
.word-block h1 { font-family: "Unbounded", sans-serif; font-size: clamp(43px, 14vw, 68px); letter-spacing: -.06em; line-height: 1; margin: 18px 0 8px; overflow-wrap: anywhere; }
.pronunciation { color: #96929f; font-family: Georgia, serif; font-size: 17px; font-style: italic; margin: 0; }
blockquote { background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.07); border-radius: 18px; color: #d9d6e1; font-size: 16px; line-height: 1.55; margin: 45px 0 0; padding: 17px 18px; }
mark { background: rgba(141,116,255,.2); border-radius: 4px; color: #d8d0ff; padding: 0 3px; }
.answer { animation: answer-in .32s ease both; border-left: 3px solid var(--violet); margin-top: 26px; padding-left: 17px; }
.answer h2 { color: #d9d1ff; font-size: 25px; letter-spacing: -.03em; margin: 8px 0 7px; }
.answer p { color: #a6a3ae; font-size: 13px; line-height: 1.5; margin: 0; }
.reveal-button { align-items: center; background: linear-gradient(135deg, #8067f4, #674fd6); border: 0; border-radius: 16px; bottom: 24px; cursor: pointer; display: flex; font-weight: 800; justify-content: space-between; left: 25px; padding: 16px 17px; position: absolute; right: 25px; }
kbd { background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.12); border-radius: 7px; color: #d9d4ef; font-family: inherit; font-size: 9px; padding: 4px 7px; }
.rating-grid { bottom: 22px; display: grid; gap: 7px; grid-template-columns: repeat(4, 1fr); left: 20px; position: absolute; right: 20px; }
.rating-grid[hidden] { display: none; }
.rating-grid button { background: rgba(255,255,255,.045); border: 1px solid var(--line); border-radius: 13px; cursor: pointer; padding: 11px 3px 9px; }
.rating-grid button:hover { background: rgba(141,116,255,.13); border-color: rgba(141,116,255,.35); }
.rating-grid span, .rating-grid small { display: block; }
.rating-grid span { font-size: 10px; font-weight: 750; }
.rating-grid small { color: #777582; font-size: 8px; margin-top: 4px; }
.rating-grid button:disabled { cursor: wait; opacity: .5; }
.bottom-nav { align-items: center; backdrop-filter: blur(20px); background: rgba(15,16,21,.88); border: 1px solid var(--line); border-radius: 21px; bottom: max(14px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(3, 1fr); left: 18px; padding: 7px; position: fixed; right: 18px; z-index: 5; }
.bottom-nav button { background: transparent; border: 0; border-radius: 14px; color: #72727c; cursor: pointer; font-size: 9px; font-weight: 700; padding: 7px; }
.bottom-nav button span { display: block; font-size: 19px; margin-bottom: 2px; }
.bottom-nav button.active { background: rgba(141,116,255,.13); color: #b5a8ff; }

.loading-screen,
.auth-screen {
  align-items: center;
  display: flex;
  flex-direction: column;
  inset: 0;
  justify-content: center;
  padding: 32px;
  position: fixed;
  text-align: center;
}

.loading-screen strong { font-family: "Unbounded", sans-serif; font-size: 20px; letter-spacing: .12em; margin-top: 18px; }
.loading-screen small { color: var(--muted); margin-top: 10px; }
.auth-screen .brand-mark { height: 54px; width: 54px; }
.auth-screen h1 { font-family: "Unbounded", sans-serif; font-size: 30px; letter-spacing: -.05em; line-height: 1.15; margin: 28px 0 12px; }
.auth-screen p { color: var(--muted); line-height: 1.6; margin: 0; max-width: 360px; }

.view { animation: view-in .24s ease both; }
.complete-card { align-items: flex-start; background: radial-gradient(circle at 85% 10%, rgba(101,225,191,.16), transparent 35%), linear-gradient(160deg, rgba(27,27,38,.98), rgba(13,14,19,.98)); border: 1px solid var(--line); border-radius: 30px; display: flex; flex-direction: column; justify-content: flex-end; min-height: 550px; padding: 28px; }
.complete-orbit { align-items: center; background: rgba(101,225,191,.1); border: 1px solid rgba(101,225,191,.25); border-radius: 50%; color: var(--mint); display: flex; font-size: 26px; height: 62px; justify-content: center; margin-bottom: auto; width: 62px; }
.complete-card h1 { font-family: "Unbounded", sans-serif; font-size: 42px; letter-spacing: -.06em; line-height: 1.05; margin: 14px 0; }
.complete-card p { color: var(--muted); line-height: 1.6; margin: 0 0 24px; }
.ghost-button { background: rgba(255,255,255,.055); border: 1px solid var(--line); border-radius: 15px; cursor: pointer; font-weight: 750; padding: 14px 18px; width: 100%; }

.section-heading { margin: 44px 2px 24px; }
.section-heading h1 { font-family: "Unbounded", sans-serif; font-size: 38px; letter-spacing: -.055em; margin: 9px 0 6px; }
.section-heading p { color: var(--muted); font-size: 13px; margin: 0; }
.search-box { align-items: center; background: rgba(255,255,255,.045); border: 1px solid var(--line); border-radius: 17px; display: flex; gap: 10px; padding: 0 15px; }
.search-box span { color: #8277bb; font-size: 22px; }
.search-box input { background: transparent; border: 0; color: var(--text); font: inherit; outline: 0; padding: 15px 0; width: 100%; }
.search-box input::placeholder { color: #6f6d77; }
.word-list { display: grid; gap: 9px; margin-top: 18px; }
.word-list-item { align-items: center; background: rgba(255,255,255,.035); border: 1px solid var(--line); border-radius: 18px; display: flex; justify-content: space-between; padding: 15px 16px; }
.word-list-item div { display: grid; min-width: 0; }
.word-list-item strong { font-size: 17px; letter-spacing: -.02em; }
.word-list-item span { color: #b8b4c2; font-size: 13px; margin-top: 3px; }
.word-list-item small { color: #6f6d78; font-size: 10px; margin-top: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.word-list-item i { background: rgba(141,116,255,.12); border-radius: 999px; color: #a697ef; font-size: 9px; font-style: normal; font-weight: 800; margin-left: 14px; padding: 6px 8px; }
.list-loading, .list-empty { color: var(--muted); padding: 50px 10px; text-align: center; }

.profile-hero { align-items: center; display: flex; flex-direction: column; margin-top: 58px; text-align: center; }
.profile-avatar { align-items: center; background: linear-gradient(145deg, #8067f4, #5236bc); border-radius: 24px; box-shadow: 0 18px 60px rgba(100,67,220,.35); display: flex; font-family: "Unbounded", sans-serif; font-size: 30px; height: 78px; justify-content: center; margin-bottom: 24px; width: 78px; }
.profile-hero h1 { font-family: "Unbounded", sans-serif; font-size: 35px; letter-spacing: -.05em; margin: 9px 0; }
.profile-hero p { color: var(--muted); font-size: 13px; margin: 0; }
.profile-stats { background: rgba(255,255,255,.035); border: 1px solid var(--line); border-radius: 22px; display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 32px; padding: 20px 10px; }
.profile-stats div { display: grid; gap: 5px; text-align: center; }
.profile-stats div + div { border-left: 1px solid var(--line); }
.profile-stats strong { font-size: 24px; }
.profile-stats span { color: var(--muted); font-size: 9px; }
.export-button { align-items: center; background: rgba(255,255,255,.045); border: 1px solid var(--line); border-radius: 17px; color: var(--text); display: flex; font-size: 13px; font-weight: 750; justify-content: space-between; margin-top: 12px; padding: 17px; text-decoration: none; }
.export-button span { color: var(--mint); font-size: 20px; }

.toast { background: #f5f2ff; border-radius: 13px; bottom: calc(100px + env(safe-area-inset-bottom)); color: #17141f; font-size: 12px; font-weight: 750; left: 50%; max-width: calc(100% - 40px); padding: 12px 16px; position: fixed; transform: translateX(-50%); z-index: 10; }
.card-leave { opacity: 0; transform: translateX(-28px) rotate(-1deg) !important; }

@keyframes answer-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

@media (min-width: 700px) {
  .app-shell { padding-top: 32px; }
  .bottom-nav { left: 50%; max-width: 520px; right: auto; transform: translateX(-50%); width: calc(100% - 36px); }
}

@media (max-width: 390px) {
  .review-card { min-height: 525px; padding: 21px; }
  .word-block { margin-top: 42px; }
  blockquote { margin-top: 34px; }
  .rating-grid { left: 15px; right: 15px; }
  .rating-grid span { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
