:root { --safe-t: env(safe-area-inset-top, 0px);
  --green: #58cc02; --green-d: #58a700; --green-l: #d7ffb8;
  --blue: #1cb0f6; --blue-d: #1899d6; --blue-l: #ddf4ff;
  --red: #ff4b4b; --red-d: #ea2b2b; --red-l: #ffdfe0;
  --yellow: #ffc800; --yellow-d: #e5a400;
  --orange: #ff9600; --orange-d: #e08600;
  --purple: #ce82ff; --purple-d: #a568cc;
  --pink: #ff86d0; --teal: #2bdecb;
  --text: #4b4b4b; --muted: #777; --line: #e5e5e5; --line-d: #cecece; --bg: #fff; --card: #fff; --soft: #f7f7f7;
  --radius: 16px;
  --font: 'Nunito', 'Segoe UI Rounded', 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans JP', 'Noto Sans SC', 'Noto Sans KR', 'Noto Sans Devanagari', 'Noto Sans Arabic', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--bg); font-weight: 700; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button { font-family: inherit; font-weight: 800; cursor: pointer; border: 0; background: none; color: inherit; }
button:disabled { cursor: default; }
input, select { font-family: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 22px; border-radius: 16px; font-size: 16px; letter-spacing: .8px; text-transform: uppercase; color: #fff; background: var(--green); box-shadow: 0 4px 0 var(--green-d); transition: transform .06s, box-shadow .06s, filter .15s; user-select: none; }
.btn:hover:not(:disabled) { filter: brightness(1.05); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 transparent; }
.btn.block { width: 100%; }
.btn.blue { background: var(--blue); box-shadow: 0 4px 0 var(--blue-d); }
.btn.red { background: var(--red); box-shadow: 0 4px 0 var(--red-d); }
.btn.orange { background: var(--orange); box-shadow: 0 4px 0 var(--orange-d); }
.btn.yellow { background: var(--yellow); box-shadow: 0 4px 0 var(--yellow-d); color: #fff; }
.btn.ghost { background: var(--card); color: var(--blue); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.btn.ghost.dark { color: var(--muted); }
.btn.flat { background: transparent; color: var(--blue); box-shadow: none; }
.btn:disabled { background: var(--line); color: #afafaf; box-shadow: 0 4px 0 var(--line-d); }
.btn.ghost:disabled { background: var(--card); }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; font-size: 22px; color: #afafaf; }
.icon-btn:hover { background: var(--soft); }

/* ---------- Layout ---------- */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar { display: none; }
.main { flex: 1; min-width: 0; padding-bottom: calc(80px + var(--safe-b)); }
.rightbar { display: none; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--card); display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 2px solid var(--line); }
.stat { display: inline-flex; align-items: center; gap: 6px; font-size: 17px; font-weight: 800; padding: 6px 8px; border-radius: 12px; }
.stat:hover { background: var(--soft); }
.stat .e { font-size: 22px; line-height: 1; }
.stat.streak { color: var(--orange); }
.stat.streak.off { color: #afafaf; filter: grayscale(1); }
.stat.gems { color: var(--blue); }
.stat.hearts { color: var(--red); }
.flag { position: relative; display: inline-block; flex: none; width: 32px; height: 32px; border-radius: 50%; overflow: hidden; background: #fff; vertical-align: middle; isolation: isolate; }
.flag svg { display: block; width: 100%; height: 100%; border-radius: 50%; }
.flag::after { content: ''; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(0,0,0,.12); pointer-events: none; }
.flag.big { width: 72px; height: 72px; box-shadow: 0 3px 0 rgba(0,0,0,.08); }
.flag.big::after { box-shadow: inset 0 0 0 3px rgba(0,0,0,.1); }
.flag.sm { width: 22px; height: 22px; }
.toast .flag { margin-right: 6px; }
.learning { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.lchip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border: 2px solid var(--line); border-radius: 999px; font-weight: 800; color: var(--text, #4b4b4b); font-size: 14px; }
.lchip:hover { background: var(--soft); }
.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--card); border-top: 2px solid var(--line); display: flex; justify-content: space-around; padding: 6px 4px calc(6px + var(--safe-b)); }
.navbtn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 10px; border-radius: 12px; border: 2px solid transparent; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.navbtn .e { font-size: 26px; line-height: 1; filter: grayscale(.35); }
.navbtn.active { border-color: #84d8ff; background: var(--blue-l); color: var(--blue); }
.navbtn.active .e { filter: none; }
.navbtn .lbl { display: none; }

@media (min-width: 700px) {
  .bottomnav { display: none; }
  .main { padding-bottom: 40px; }
  .sidebar { display: flex; flex-direction: column; gap: 6px; width: 92px; padding: 24px 10px; border-right: 2px solid var(--line); position: sticky; top: 0; height: 100vh; }
  .sidebar .logo { font-size: 30px; text-align: center; margin-bottom: 18px; }
  .sidebar .logo .word { display: none; }
  .sidebar .navbtn { flex-direction: row; gap: 16px; font-size: 15px; padding: 10px 14px; justify-content: center; }
  .sidebar .navbtn .e { font-size: 30px; }
}
@media (min-width: 1100px) {
  .sidebar { width: 256px; padding: 24px 16px; }
  .sidebar .logo { text-align: left; padding-left: 14px; font-size: 32px; color: var(--green); font-weight: 900; letter-spacing: -1px; }
  .sidebar .logo .word { display: inline; }
  .sidebar .navbtn { justify-content: flex-start; }
  .sidebar .navbtn .lbl { display: inline; }
  .rightbar { display: flex; flex-direction: column; gap: 20px; width: 380px; padding: 20px 24px; position: sticky; top: 0; height: 100vh; overflow: auto; }
  .main .topbar.mobile-only { display: none; }
}
@media (min-width: 700px) and (max-width: 1099px) { .sidebar .navbtn .lbl { display: none; } }

.page { max-width: 620px; margin: 0 auto; padding: 18px 16px; }
.page h1 { font-size: 26px; font-weight: 900; margin: 6px 0 14px; }
.page h2 { font-size: 21px; font-weight: 900; margin: 18px 0 10px; }
.card { border: 2px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--card); }
.card + .card { margin-top: 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

/* ---------- Path ---------- */
.unit { margin: 18px auto 8px; max-width: 560px; padding: 0 12px; }
.unit-banner { border-radius: 16px; color: #fff; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.unit-banner .u-k { font-size: 13px; opacity: .85; text-transform: uppercase; letter-spacing: 1px; }
.unit-banner .u-t { font-size: 21px; font-weight: 900; margin: 2px 0; }
.unit-banner .u-d { font-size: 15px; opacity: .95; font-weight: 700; }
.guide-btn { flex-shrink: 0; color: #fff; border: 2px solid rgba(255,255,255,.45); border-radius: 14px; padding: 10px 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; display: inline-flex; gap: 6px; align-items: center; }
.guide-btn:hover { background: rgba(255,255,255,.12); }
.path { position: relative; display: flex; flex-direction: column; align-items: center; padding: 26px 0 10px; gap: 18px; }
.node-wrap { position: relative; }
.node { position: relative; width: 74px; height: 68px; border-radius: 50%; font-size: 30px; display: flex; align-items: center; justify-content: center; color: #fff; transition: transform .08s; }
.node:active:not(.locked) { transform: translateY(6px); }
.node.locked { background: var(--line); box-shadow: 0 7px 0 var(--line-d); color: #afafaf; filter: grayscale(1); }
.node.done { background: var(--yellow); box-shadow: 0 7px 0 var(--yellow-d); }
.node.current { box-shadow: 0 7px 0 rgba(0,0,0,.22); }
.node.current::after { content: ''; position: absolute; inset: -10px; border-radius: 50%; border: 6px solid var(--line); z-index: -1; }
.node .ico { line-height: 1; }
.node.trophy { border-radius: 22px; }
.start-bubble { position: absolute; top: -46px; left: 50%; transform: translateX(-50%); background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 7px 12px; font-size: 15px; font-weight: 900; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; animation: bob 1.4s ease-in-out infinite; z-index: 2; }
.start-bubble::after { content: ''; position: absolute; bottom: -8px; left: 50%; width: 12px; height: 12px; background: var(--card); border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: translateX(-50%) rotate(45deg); }
@keyframes bob { 0%,100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -6px); } }
.path-mascot { position: absolute; width: 110px; opacity: .95; pointer-events: none; }
.popover { position: absolute; top: 84px; left: 50%; transform: translateX(-50%); width: 280px; z-index: 15; border-radius: 16px; padding: 16px; color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.15); animation: pop .18s ease-out; }
.popover.locked { background: var(--soft); color: var(--muted); border: 2px solid var(--line); }
.popover h3 { margin: 0 0 4px; font-size: 18px; }
.popover p { margin: 0 0 12px; font-size: 15px; opacity: .95; }
.popover .btn { width: 100%; background: #fff; box-shadow: 0 4px 0 rgba(0,0,0,.15); }
.popover::before { content: ''; position: absolute; top: -8px; left: 50%; width: 16px; height: 16px; background: inherit; transform: translateX(-50%) rotate(45deg); border-left: inherit; border-top: inherit; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -6px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
.section-divider { display: flex; align-items: center; gap: 14px; color: #afafaf; margin: 24px 20px; font-size: 16px; }
.section-divider::before, .section-divider::after { content: ''; flex: 1; height: 2px; background: var(--line); }

/* unit colours */
.c-green { background: var(--green); } .c-green.node.current, .c-green.node:not(.locked):not(.done) { box-shadow: 0 7px 0 var(--green-d); }
.c-blue { background: var(--blue); } .c-blue.node.current { box-shadow: 0 7px 0 var(--blue-d); }
.c-purple { background: var(--purple); } .c-purple.node.current { box-shadow: 0 7px 0 var(--purple-d); }
.c-orange { background: var(--orange); } .c-orange.node.current { box-shadow: 0 7px 0 var(--orange-d); }
.c-red { background: var(--red); } .c-red.node.current { box-shadow: 0 7px 0 var(--red-d); }
.c-teal { background: #00c2a8; } .c-teal.node.current { box-shadow: 0 7px 0 #00a08b; }
.c-pink { background: #ff6fb5; } .c-pink.node.current { box-shadow: 0 7px 0 #d9529a; }
.c-yellow { background: #f5b700; } .c-yellow.node.current { box-shadow: 0 7px 0 #cc9800; }
.unit-banner.c-green { box-shadow: 0 4px 0 var(--green-d); } .unit-banner.c-blue { box-shadow: 0 4px 0 var(--blue-d); } .unit-banner.c-purple { box-shadow: 0 4px 0 var(--purple-d); } .unit-banner.c-orange { box-shadow: 0 4px 0 var(--orange-d); } .unit-banner.c-red { box-shadow: 0 4px 0 var(--red-d); } .unit-banner.c-teal { box-shadow: 0 4px 0 #00a08b; } .unit-banner.c-pink { box-shadow: 0 4px 0 #d9529a; } .unit-banner.c-yellow { box-shadow: 0 4px 0 #cc9800; }
.popover.c-green, .popover.c-blue, .popover.c-purple, .popover.c-orange, .popover.c-red, .popover.c-teal, .popover.c-pink, .popover.c-yellow { border: 0; }
.popover.c-green .btn { color: var(--green); } .popover.c-blue .btn { color: var(--blue); } .popover.c-purple .btn { color: var(--purple); } .popover.c-orange .btn { color: var(--orange); } .popover.c-red .btn { color: var(--red); } .popover.c-teal .btn { color: #00a08b; } .popover.c-pink .btn { color: #d9529a; } .popover.c-yellow .btn { color: #cc9800; }

/* ---------- Right bar widgets ---------- */
.widget { border: 2px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.practice-card { display: flex; align-items: center; gap: 14px; margin: 0 0 18px; padding: 14px 16px; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 16px; color: var(--text); text-decoration: none; background: var(--bg); }
.practice-card:active { transform: translateY(2px); border-bottom-width: 2px; }
.practice-card .pc-ico { font-size: 30px; }
.practice-card .pc-t { display: block; font-size: 17px; font-weight: 900; color: var(--green-d, #58a700); }
.practice-card .pc-d { display: block; font-size: 14px; color: var(--muted); }
.practice-card .pc-go { font-size: 28px; color: var(--muted); }
.widget h3 { margin: 0 0 12px; font-size: 19px; font-weight: 900; display: flex; justify-content: space-between; align-items: center; }
.widget h3 a { font-size: 14px; color: var(--blue); text-decoration: none; text-transform: uppercase; }
.progress { height: 16px; background: var(--line); border-radius: 99px; overflow: hidden; position: relative; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: var(--yellow); transition: width .5s ease; position: relative; }
.progress > i::after { content: ''; position: absolute; top: 3px; left: 8px; right: 8px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.35); }
.progress.green > i { background: var(--green); }
.progress.blue > i { background: var(--blue); }
.progress-label { position: absolute; inset: 0; font-size: 12px; display: flex; align-items: center; justify-content: center; color: #afafaf; }
.quest { display: flex; gap: 14px; align-items: center; padding: 10px 0; }
.quest + .quest { border-top: 2px solid var(--line); }
.quest .qi { font-size: 32px; width: 42px; text-align: center; }
.quest .qt { font-size: 16px; margin-bottom: 8px; }
.quest .qr { font-size: 26px; }
.quest.claimable .qr { animation: wiggle 1s infinite; cursor: pointer; }
@keyframes wiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }

/* ---------- Onboarding / courses ---------- */
.welcome { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; gap: 14px; }
.welcome h1 { font-size: 30px; font-weight: 900; margin: 6px 0 0; max-width: 460px; line-height: 1.25; }
.welcome p { font-size: 18px; color: var(--muted); margin: 0 0 10px; max-width: 420px; }
.welcome .btns { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 14px; }
.brand { font-size: 40px; font-weight: 900; color: var(--green); letter-spacing: -1.5px; }
.mascot { width: 180px; height: 180px; }
.mascot.sm { width: 110px; height: 110px; }
.mascot.xs { width: 72px; height: 72px; }
.mascot.bounce { animation: mbounce 1.6s ease-in-out infinite; }
@keyframes mbounce { 0%,100% { transform: translateY(0) scale(1, 1); } 40% { transform: translateY(-14px) scale(.98, 1.02); } 55% { transform: translateY(0) scale(1.04, .96); } }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.course-tile { border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 16px; padding: 18px 10px 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 17px; background: var(--card); transition: background .12s, transform .06s; }
.course-tile:hover { background: var(--soft); }
.course-tile:active { transform: translateY(2px); border-bottom-width: 2px; }
.course-tile.sel { border-color: #84d8ff; background: var(--blue-l); }
.course-tile .native { font-size: 14px; color: var(--muted); font-weight: 700; }
.course-tile .mini { width: 100%; }
.goal-opt { display: flex; justify-content: space-between; width: 100%; padding: 16px 18px; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 14px; font-size: 17px; background: var(--card); }
.goal-opt.sel { border-color: #84d8ff; background: var(--blue-l); color: var(--blue); }
.goal-list { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 420px; }

/* ---------- Lesson ---------- */
.lesson { position: fixed; inset: 0; z-index: 100; background: var(--card); display: flex; flex-direction: column; animation: slideup .25s ease-out; }
@keyframes slideup { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.lesson-top { display: flex; align-items: center; gap: 14px; padding: 16px 16px 6px; max-width: 1000px; width: 100%; margin: 0 auto; }
.lesson-top .progress { flex: 1; }
.lesson-top .progress > i { background: var(--green); }
.hearts-pill { color: var(--red); font-size: 18px; display: flex; align-items: center; gap: 4px; min-width: 50px; justify-content: flex-end; }
.hearts-pill.inf { color: var(--blue); }
.hearts-pill.shake { animation: shake .4s; }
.combo { text-align: center; color: var(--orange); font-size: 15px; height: 20px; letter-spacing: .5px; text-transform: uppercase; }
.lesson-body { flex: 1; overflow-y: auto; display: flex; justify-content: center; padding: 8px 16px 20px; }
.ex { width: 100%; max-width: 600px; display: flex; flex-direction: column; gap: 18px; animation: fadein .25s ease-out; }
@keyframes fadein { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
.ex-badge { color: var(--purple); font-size: 14px; text-transform: uppercase; letter-spacing: 1px; display: flex; gap: 6px; align-items: center; }
.ex-title { font-size: 24px; font-weight: 900; margin: 0; line-height: 1.25; }
.prompt { display: flex; gap: 12px; align-items: flex-start; }
.prompt .mascot { flex-shrink: 0; }
.bubble { position: relative; border: 2px solid var(--line); border-radius: 16px; padding: 12px 16px; font-size: 19px; line-height: 1.5; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.bubble::before { content: ''; position: absolute; left: -9px; top: 22px; width: 14px; height: 14px; background: var(--card); border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: rotate(45deg); }
.tok { border-bottom: 2px dashed #cfcfcf; cursor: pointer; position: relative; }
.tok:hover { border-bottom-color: var(--blue); }
.tok-tip { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 6px 10px; font-size: 15px; white-space: nowrap; z-index: 5; box-shadow: 0 4px 10px rgba(0,0,0,.08); color: var(--text); }
.roman { display: block; font-size: 14px; color: var(--muted); font-weight: 700; margin-top: 2px; }
.target-text { font-size: 20px; }
.big-word { font-size: 34px; font-weight: 900; text-align: center; }
.speak { flex-shrink: 0; width: 44px; height: 44px; border-radius: 12px; background: var(--blue); color: #fff; font-size: 20px; box-shadow: 0 4px 0 var(--blue-d); display: inline-flex; align-items: center; justify-content: center; }
.speak:active { transform: translateY(4px); box-shadow: none; }
.speak.slow { background: var(--blue); width: 44px; }
.listen-btns { display: flex; justify-content: center; gap: 18px; align-items: flex-end; padding: 8px 0; }
.listen-big { width: 120px; height: 120px; border-radius: 26px; font-size: 52px; }
.listen-slow { width: 76px; height: 76px; border-radius: 20px; font-size: 32px; }
.choices { display: grid; gap: 12px; }
.choices.cards { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 560px) { .choices.cards.c3 { grid-template-columns: repeat(3, 1fr); } .choices.cards.c4 { grid-template-columns: repeat(4, 1fr); } }
.choice { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 14px; font-size: 18px; text-align: left; background: var(--card); transition: background .1s, border-color .1s; }
.choice:hover:not(:disabled) { background: var(--soft); }
.choice:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 2px; }
.choice .k { width: 30px; height: 30px; border: 2px solid var(--line); border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; color: #afafaf; flex-shrink: 0; }
.choice.card { flex-direction: column; justify-content: center; text-align: center; padding: 18px 10px 14px; min-height: 150px; }
.choice.card .emo { font-size: 54px; line-height: 1.1; }
.choice.card .k { position: absolute; }
.choice.sel { border-color: #84d8ff; background: var(--blue-l); color: var(--blue); }
.choice.sel .k { border-color: #84d8ff; color: var(--blue); }
.choice.right { border-color: #a5ed6e; background: var(--green-l); color: var(--green-d); }
.choice.wrong { border-color: #ffb2b2; background: var(--red-l); color: var(--red-d); animation: shake .4s; }
.choice.gone { opacity: .45; border-color: var(--line); background: var(--card); color: #cfcfcf; pointer-events: none; border-bottom-width: 2px; }
.choice.gone .roman { color: #ddd; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match .col { display: flex; flex-direction: column; gap: 12px; }
.match .choice { justify-content: center; text-align: center; min-height: 60px; flex-direction: column; gap: 0; }
.answer-zone { min-height: 128px; border-top: 2px solid var(--line); border-bottom: 2px solid var(--line); padding: 10px 2px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px; background-image: linear-gradient(transparent 61px, var(--line) 61px, var(--line) 63px, transparent 63px); background-size: 100% 64px; }
.bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; min-height: 60px; }
.word { min-height: 48px; padding: 8px 14px; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 12px; font-size: 18px; background: var(--card); display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2; animation: popin .15s ease-out; }
.word:active { transform: translateY(2px); border-bottom-width: 2px; }
.word.used { background: var(--line); color: transparent; border-color: var(--line); pointer-events: none; animation: none; }
.word.used .roman { color: transparent; }
.word .roman { font-size: 12px; margin: 0; }
@keyframes popin { from { transform: scale(.85); opacity: .3; } to { transform: scale(1); opacity: 1; } }
.blank-line { display: inline-block; min-width: 90px; border-bottom: 3px solid var(--text); text-align: center; padding: 0 6px; color: var(--blue); }
.sentence-fill { font-size: 22px; line-height: 2; text-align: center; padding: 10px 0; }
.type-area { width: 100%; min-height: 130px; border: 2px solid var(--line); border-radius: 16px; background: var(--soft); padding: 14px; font-size: 19px; font-weight: 700; color: var(--text); resize: none; outline: none; }
.type-area:focus { border-color: #84d8ff; background: var(--card); }
.accents { display: flex; flex-wrap: wrap; gap: 6px; }
.accents button { min-width: 40px; height: 40px; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 10px; font-size: 17px; background: var(--card); }
.rtl { direction: rtl; }
.lesson-foot { border-top: 2px solid var(--line); padding: 16px 16px calc(16px + var(--safe-b)); }
.lesson-foot .inner { max-width: 1000px; margin: 0 auto; display: flex; gap: 12px; justify-content: space-between; align-items: center; }
.lesson-foot .btn { min-width: 150px; }
@media (max-width: 559px) { .lesson-foot .inner .btn.check { flex: 1; } .lesson-foot .inner .btn.skip { display: none; } }
.feedback { position: fixed; left: 0; right: 0; bottom: 0; z-index: 110; padding: 18px 16px calc(16px + var(--safe-b)); animation: fbup .2s ease-out; }
@keyframes fbup { from { transform: translateY(100%); } to { transform: none; } }
.feedback .inner { max-width: 1000px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 700px) { .feedback .inner { flex-direction: row; align-items: center; justify-content: space-between; } .feedback .btn { min-width: 150px; } }
.feedback.ok { background: var(--green-l); color: var(--green-d); }
.feedback.bad { background: var(--red-l); color: var(--red-d); }
.feedback .fb-h { font-size: 24px; font-weight: 900; display: flex; align-items: center; gap: 10px; }
.feedback .fb-h .badge { width: 40px; height: 40px; border-radius: 50%; background: var(--card); display: inline-flex; align-items: center; justify-content: center; font-size: 22px; }
.feedback .fb-b { font-size: 17px; margin-top: 4px; }
.feedback .fb-b .lbl { font-weight: 900; }
.feedback.ok .btn { background: var(--green); box-shadow: 0 4px 0 var(--green-d); }
.feedback.bad .btn { background: var(--red); box-shadow: 0 4px 0 var(--red-d); }

/* results */
.results { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 16px; padding: 20px; }
.results h1 { font-size: 30px; font-weight: 900; color: var(--yellow-d); margin: 0; }
.result-cards { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.rcard { width: 110px; border-radius: 16px; border: 2px solid; overflow: hidden; animation: popin .35s ease-out both; }
.rcard .rh { color: #fff; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; padding: 6px 4px; }
.rcard .rv { background: var(--card); font-size: 22px; font-weight: 900; padding: 12px 4px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.rcard.xp { border-color: var(--yellow); } .rcard.xp .rh { background: var(--yellow); } .rcard.xp .rv { color: var(--yellow-d); }
.rcard.acc { border-color: var(--green); } .rcard.acc .rh { background: var(--green); } .rcard.acc .rv { color: var(--green); }
.rcard.time { border-color: var(--blue); } .rcard.time .rh { background: var(--blue); } .rcard.time .rv { color: var(--blue); }
.rcard.gem { border-color: var(--purple); } .rcard.gem .rh { background: var(--purple); } .rcard.gem .rv { color: var(--purple-d); }
.streak-big { font-size: 110px; line-height: 1; animation: flame 1.2s ease-in-out infinite; }
@keyframes flame { 0%,100% { transform: scale(1) rotate(-2deg); } 50% { transform: scale(1.08) rotate(2deg); } }
.streak-num { font-size: 64px; font-weight: 900; color: var(--orange); line-height: 1; }
.week { display: flex; gap: 8px; justify-content: center; }
.week .d { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.week .d i { width: 30px; height: 30px; border-radius: 50%; background: var(--line); display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 15px; color: #fff; }
.week .d.on i { background: var(--orange); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 200; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* modal */
.modal-bg { position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; animation: fadebg .2s; }
@media (min-width: 600px) { .modal-bg { align-items: center; } }
@keyframes fadebg { from { opacity: 0; } }
.modal { background: var(--card); width: 100%; max-width: 480px; border-radius: 20px 20px 0 0; padding: 24px 20px calc(20px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; text-align: center; max-height: 90vh; overflow: auto; animation: slideup .25s ease-out; }
@media (min-width: 600px) { .modal { border-radius: 20px; } }
.modal h2 { margin: 0; font-size: 24px; font-weight: 900; }
.modal p { margin: 0; color: var(--muted); font-size: 17px; }
.modal .big-emoji { font-size: 72px; line-height: 1; }

/* guidebook */
.vocab-table { width: 100%; border-collapse: collapse; }
.vocab-table td { padding: 10px 6px; border-bottom: 2px solid var(--line); font-size: 17px; vertical-align: middle; }
.vocab-table td.e { font-size: 26px; width: 40px; }
.vocab-table td.s { width: 50px; text-align: right; }
.vocab-table .speak { width: 38px; height: 38px; font-size: 16px; }
.phrase { border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; }
.phrase + .phrase { margin-top: 10px; }

/* profile / leaderboard / achievements */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.statbox { border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; gap: 10px; align-items: center; }
.statbox .e { font-size: 26px; }
.statbox .v { font-size: 19px; font-weight: 900; }
.statbox .l { font-size: 14px; color: var(--muted); }
.avatar { width: 92px; height: 92px; border-radius: 50%; background: var(--blue-l); border: 3px dashed #84d8ff; display: flex; align-items: center; justify-content: center; font-size: 46px; color: var(--blue); flex-shrink: 0; }
.chart { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 10px; }
.chart .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; font-size: 12px; color: var(--muted); }
.chart .bar i { width: 100%; max-width: 40px; background: var(--yellow); border-radius: 8px 8px 4px 4px; min-height: 4px; transition: height .6s ease; }
.chart .bar.today i { background: var(--orange); }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; font-size: 17px; }
.lb-row.me { background: var(--blue-l); color: var(--blue); }
.lb-row .rank { width: 30px; text-align: center; font-weight: 900; color: var(--muted); }
.lb-row .rank.r1 { color: var(--yellow-d); } .lb-row .rank.r2 { color: #9a9a9a; } .lb-row .rank.r3 { color: #c47a3a; }
.lb-row .av { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; background: var(--soft); }
.lb-zone { text-align: center; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; padding: 6px; margin: 4px 0; border-radius: 10px; }
.lb-zone.up { color: var(--green); background: var(--green-l); }
.lb-zone.down { color: var(--red); background: var(--red-l); }
.league-badge { font-size: 66px; text-align: center; }
.ach { display: flex; gap: 14px; align-items: center; padding: 14px 0; }
.ach + .ach { border-top: 2px solid var(--line); }
.ach .ai { width: 64px; height: 72px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 34px; flex-shrink: 0; background: var(--line); filter: grayscale(1); opacity: .6; }
.ach.got .ai { filter: none; opacity: 1; box-shadow: 0 4px 0 rgba(0,0,0,.15); }
.ach .an { font-size: 18px; font-weight: 900; }
.ach .ad { font-size: 15px; color: var(--muted); margin: 2px 0 8px; }
.setting { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; gap: 12px; font-size: 17px; }
.setting + .setting { border-top: 2px solid var(--line); }
.switch { width: 54px; height: 32px; border-radius: 99px; background: var(--line); position: relative; transition: background .2s; flex-shrink: 0; }
.switch::after { content: ''; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch.on { background: var(--blue); }
.switch.on::after { transform: translateX(22px); }
.seg { display: flex; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { padding: 8px 12px; font-size: 15px; color: var(--muted); }
.seg button.on { background: var(--blue-l); color: var(--blue); }
.text-input { width: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 17px; font-weight: 700; background: var(--soft); color: var(--text); outline: none; }
.text-input:focus { border-color: #84d8ff; background: var(--card); }
.toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%) translateY(-120px); background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 12px 18px; z-index: 400; font-size: 16px; box-shadow: 0 8px 24px rgba(0,0,0,.12); transition: transform .3s ease; display: flex; gap: 10px; align-items: center; max-width: 92vw; }
.toast.show { transform: translateX(-50%) translateY(0); }
.practice-card { display: flex; gap: 14px; align-items: center; padding: 16px; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 16px; width: 100%; text-align: left; background: var(--card); font-size: 17px; }
.practice-card:hover { background: var(--soft); }
.practice-card + .practice-card { margin-top: 12px; }
.practice-card .pi { font-size: 40px; width: 56px; text-align: center; }
.practice-card .pd { font-size: 15px; color: var(--muted); font-weight: 700; margin-top: 2px; }
.tts-warn { font-size: 14px; color: var(--orange-d); background: #fff4e0; border-radius: 12px; padding: 8px 12px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ---------- app.js additions ---------- */
a.btn, a.navbtn, a.stat { text-decoration: none; }
a.stat { color: inherit; }
.choice { position: relative; }
.choice.card .k { top: 8px; left: 8px; }
.choice.right .k { border-color: #a5ed6e; color: var(--green-d); }
.choice.wrong .k { border-color: #ffb2b2; color: var(--red-d); }
.course-tile .progress.mini { height: 10px; display: block; }
.practice-card:disabled { cursor: default; }
.modal h3 { font-size: 18px; margin: 14px 0 8px; }
.match .choice:disabled:not(.gone) { color: inherit; }
.lesson-body button:disabled.choice:not(.right):not(.wrong):not(.gone) { opacity: .9; }

/* ---------- Social (accounts, profiles, chat) ---------- */
.navbtn .e { position: relative; }
.nbadge { position: absolute; top: -6px; right: -10px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 12px; font-weight: 900; line-height: 20px; text-align: center; border: 2px solid #fff; font-family: var(--font); filter: none; letter-spacing: 0; }
.nbadge.static { position: static; border: 0; flex: none; }
.nbadge[hidden] { display: none; }
@media (max-width: 699px) { .bottomnav .navbtn { padding: 6px 6px; } .bottomnav .navbtn .e { font-size: 24px; } }
.s-loading { display: flex; justify-content: center; padding: 40px 0; }
.spin { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--green); animation: sspin .8s linear infinite; }
@keyframes sspin { to { transform: rotate(360deg); } }
.s-empty { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 18px; }
.s-empty h2 { margin: 0; } .s-empty p { margin: 0; }
.s-empty .btn { min-width: 220px; }
.s-narrow { max-width: 460px; }
.s-tabs { margin: 6px 0 4px; } .s-tabs a { flex: 1; text-align: center; padding: 10px 12px; font-size: 16px; color: var(--muted); font-weight: 800; } .s-tabs a.on { background: var(--blue-l); color: var(--blue); }
.s-form { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; text-align: left; }
.s-form label, .s-field { display: flex; flex-direction: column; gap: 6px; font-size: 15px; font-weight: 800; color: var(--text); }
.s-form input:not([type=checkbox]):not([type=radio]), .s-form textarea, .s-form select, .s-search input { width: 100%; font: inherit; font-weight: 700; font-size: 17px; color: var(--text); background: var(--soft); border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; outline: none; }
.s-form textarea { resize: vertical; min-height: 80px; }
.s-form input:focus, .s-form textarea:focus, .s-form select:focus, .s-search input:focus { border-color: var(--blue); background: var(--card); }
.s-prefix { display: flex; align-items: center; background: var(--soft); border: 2px solid var(--line); border-radius: 14px; padding-left: 14px; }
.s-prefix span { color: var(--muted); font-size: 17px; }
.s-prefix input { border: 0 !important; background: transparent !important; padding-left: 4px !important; }
.s-prefix:focus-within { border-color: var(--blue); background: var(--card); }
.s-hint { font-weight: 700; color: var(--muted); font-size: 13px; } .s-hint.ok { color: var(--green-d); } .s-hint.bad { color: var(--red-d); }
.s-check, .s-radio { flex-direction: row !important; align-items: flex-start; gap: 10px !important; font-weight: 700 !important; cursor: pointer; }
.s-check input, .s-radio input { width: 22px; height: 22px; accent-color: var(--green); flex: none; margin: 0; }
.s-check a, .s-link, .s-terms a { color: var(--blue); }
.s-link { text-align: center; font-weight: 800; }
.s-err { color: var(--red-d); background: var(--red-l); border-radius: 12px; padding: 10px 12px; margin: 0; font-size: 15px; }
.s-err[hidden] { display: none; }
.s-diag { display: block; margin: 4px 2px 0; font-size: 11px; line-height: 1.35; color: var(--muted, #888); word-break: break-all; opacity: .85; }
.s-diag[hidden] { display: none; }
.s-form.left { width: 100%; }
.sav { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%; overflow: hidden; font-weight: 900; background: var(--soft); }
.sav img { width: 100%; height: 100%; object-fit: cover; display: block; }
.s-ptop { display: flex; align-items: center; gap: 16px; }
.s-ptop h1 { margin: 0 !important; font-size: 24px !important; line-height: 1.2; word-break: break-word; }
.s-counts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 15px; color: var(--muted); }
.s-counts a:hover { color: var(--blue); } .s-counts b { color: var(--text); }
.s-bio { font-size: 16px; font-weight: 700; margin: 12px 0 4px; white-space: pre-wrap; word-break: break-word; }
.s-langs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; font-size: 14px; }
.s-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border: 2px solid var(--line); border-radius: 999px; font-size: 14px; font-weight: 800; background: var(--card); }
.s-chip .flag { margin-left: -6px; }
.s-chips { display: flex; flex-wrap: wrap; gap: 8px; max-height: 220px; overflow: auto; padding: 2px; }
.s-chip.pick { cursor: pointer; color: var(--muted); }
.s-chip.pick.on { border-color: #84d8ff; background: var(--blue-l); color: var(--blue); }
.s-btnrow { flex-wrap: wrap; margin-top: 14px; gap: 10px; }
.s-btnrow .btn { min-height: 44px; padding: 0 16px; font-size: 14px; }
.s-more { min-width: 48px; padding: 0 12px !important; font-size: 22px !important; letter-spacing: 0; }
.s-mini { min-height: 38px !important; padding: 0 14px !important; font-size: 13px !important; box-shadow: 0 3px 0 var(--line); }
.btn.blue.s-mini { box-shadow: 0 3px 0 var(--blue-d); } .btn.red.s-mini { box-shadow: 0 3px 0 var(--red-d); }
.s-demo { display: inline-block; vertical-align: middle; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .6px; color: var(--purple-d); background: #f3e6ff; border-radius: 8px; padding: 2px 7px; }
.s-soon { display: inline-block; font-size: 11px; font-weight: 900; text-transform: uppercase; color: var(--orange-d); background: #fff1dc; border-radius: 8px; padding: 2px 7px; margin-left: 4px; }
.s-join { margin: 16px 0 6px; } .s-join .row { align-items: flex-start; } .s-join b { font-size: 17px; }
.s-since { font-size: 14px; margin-top: 14px; }
.s-back { font-size: 34px; line-height: 1; color: var(--muted); padding: 0 8px 4px 0; font-weight: 900; }
.s-list { padding: 6px; display: flex; flex-direction: column; }
.s-person, .s-conv { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; }
.s-person:hover, .s-conv:hover { background: var(--soft); }
.s-person .grow, .s-conv .grow { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.s-person .muted { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-conv .row { gap: 8px; }
.s-prev { color: var(--muted); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.s-conv.unread .s-prev { color: var(--text); font-weight: 800; }
.s-search { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; position: relative; }
.s-search span { position: absolute; left: 14px; font-size: 18px; } .s-search input { padding-left: 44px !important; }
.s-tile { display: flex; align-items: center; gap: 16px; } .s-tile .big-emoji { font-size: 40px; } .s-tile > span:last-child { display: flex; flex-direction: column; gap: 4px; } .s-tile b { font-size: 18px; }
a.s-tile:hover { background: var(--soft); } .s-tile.soon { opacity: .75; }
.s-avedit { display: flex; align-items: center; gap: 16px; } .s-avedit > div { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.s-danger { margin-top: 22px; } .s-danger .setting { font-size: 16px; }
.s-terms p, .s-terms li { font-size: 16px; font-weight: 600; line-height: 1.5; }
.s-full { max-width: 100%; max-height: 70vh; border-radius: 14px; object-fit: contain; }
/* chat */
.chatwrap { display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-width: 760px; margin: 0 auto; }
.chathead { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 2px solid var(--line); background: var(--card); }
.chathead .s-who { gap: 10px; min-width: 0; } .chathead .s-who span { display: flex; flex-direction: column; min-width: 0; } .chathead .s-who b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .chathead small { font-size: 13px; }
.chathead .s-more { min-height: 40px; box-shadow: none; border: 0; }
.msgs { flex: 1; overflow-y: auto; padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 3px; background: var(--soft); overscroll-behavior: contain; }
.msg { display: flex; flex-direction: column; max-width: 78%; }
.msg.me { align-self: flex-end; align-items: flex-end; } .msg.them { align-self: flex-start; align-items: flex-start; }
.bubble { position: relative; padding: 8px 12px 6px; border-radius: 18px; font-size: 16px; font-weight: 700; line-height: 1.35; cursor: pointer; word-break: break-word; white-space: pre-wrap; }
.msg.them .bubble { background: var(--card); border: 2px solid var(--line); border-bottom-left-radius: 6px; }
.msg.me .bubble { background: var(--green); color: #fff; border-bottom-right-radius: 6px; box-shadow: 0 2px 0 var(--green-d); }
.bubble .time { display: block; text-align: right; font-size: 11px; opacity: .7; margin-top: 2px; font-weight: 700; }
.msg.pic .bubble { padding: 4px; }
.msg.pic .bubble .time { padding: 0 8px 2px; }
.s-img { display: block; padding: 0; border-radius: 14px; overflow: hidden; background: var(--line); }
.s-img img { display: block; max-width: min(260px, 60vw); max-height: 320px; min-width: 120px; min-height: 80px; width: auto; height: auto; object-fit: cover; }
.msg .status { font-size: 12px; color: var(--muted); margin: 2px 6px 4px; } .msg .status .bad { color: var(--red-d); }
.dayline { text-align: center; margin: 12px 0 6px; } .dayline span { font-size: 12px; color: var(--muted); background: var(--card); border: 2px solid var(--line); border-radius: 999px; padding: 3px 10px; text-transform: uppercase; letter-spacing: .5px; }
.chat-empty { margin: auto; }
.s-more-msgs { align-self: center; min-height: 36px; font-size: 13px; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px calc(8px + var(--safe-b)); border-top: 2px solid var(--line); background: var(--card); }
.composer.blocked { align-items: center; justify-content: space-between; padding: 14px; }
.composer textarea { flex: 1; resize: none; font: inherit; font-weight: 700; font-size: 16px; border: 2px solid var(--line); background: var(--soft); border-radius: 22px; padding: 10px 14px; max-height: 140px; outline: none; color: var(--text); }
.composer textarea:focus { border-color: var(--blue); background: var(--card); }
.s-attach, .s-send { flex: none; width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 22px; }
.s-attach:hover { background: var(--soft); }
.s-send { background: var(--green); color: #fff; box-shadow: 0 3px 0 var(--green-d); font-size: 19px; }
body.in-chat .main { padding-bottom: 0; }
@media (max-width: 699px) { body.in-chat .bottomnav, body.in-chat .topbar { display: none; } }
@media (min-width: 700px) { .chatwrap { height: 100vh; border-left: 2px solid var(--line); border-right: 2px solid var(--line); } }
@media (min-width: 1100px) { body.in-chat .main { padding-bottom: 0; } }
.big-emoji { font-size: 56px; line-height: 1; }
.page > .card.s-tile { margin-top: 14px; } .page h1 + .card.s-tile { margin-top: 8px; }

/* ---------------- Phase 2: voice messages + voice calls ---------------- */
.composer { position: relative; }
.s-mic { flex: none; width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 21px; background: var(--blue); color: #fff; box-shadow: 0 3px 0 var(--blue-d); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.composer .s-send { display: none; }
.composer.has-text .s-send { display: inline-flex; } .composer.has-text .s-mic { display: none; }
.s-recbar { display: none; position: absolute; left: 0; right: 62px; top: 0; bottom: 0; padding: 8px 10px calc(8px + var(--safe-b)); background: var(--card); align-items: center; gap: 10px; z-index: 2; }
.composer.recording .s-recbar { display: flex; }
.composer.recording .s-mic { display: inline-flex; background: var(--red); box-shadow: 0 3px 0 var(--red-d); transform: scale(1.18); animation: recpulse 1.2s ease-in-out infinite; }
.composer.recording.has-text .s-send { display: none; }
.composer.rec-tap .s-recbar { right: 0; }
.s-rec-x { flex: none; width: 44px; height: 44px; border-radius: 50%; font-size: 20px; display: inline-flex; align-items: center; justify-content: center; }
.s-rec-x:hover { background: var(--red-l); }
.s-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); animation: blink 1s steps(2, start) infinite; flex: none; }
.s-rectime { font-weight: 900; font-variant-numeric: tabular-nums; font-size: 16px; white-space: nowrap; }
.s-rechint { color: var(--muted); font-weight: 800; font-size: 14px; flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-rechint.warn { color: var(--red-d); }
.s-rechint.tap, .composer.rec-tap #sRecHint { display: none; } .composer.rec-tap .s-rechint.tap { display: block; }
.s-rec-send { display: none; flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--green); color: #fff; box-shadow: 0 3px 0 var(--green-d); font-size: 19px; align-items: center; justify-content: center; }
.composer.rec-tap .s-rec-send { display: inline-flex; }
@keyframes recpulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,75,75,.45); } 50% { box-shadow: 0 0 0 10px rgba(255,75,75,0); } }
@keyframes blink { to { visibility: hidden; } }

.msg.voice .bubble { min-width: 230px; }
.s-voice { display: flex; align-items: center; gap: 10px; white-space: normal; }
.s-vplay { flex: none; width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; background: var(--blue); color: #fff; letter-spacing: -2px; }
.msg.me .s-vplay { background: #fff; color: var(--green-d); }
.s-vbar { flex: 1; height: 8px; border-radius: 99px; background: var(--line); position: relative; overflow: hidden; min-width: 90px; cursor: pointer; }
.msg.me .s-vbar { background: rgba(255,255,255,.4); }
.s-vbar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--blue); border-radius: 99px; }
.msg.me .s-vbar i { background: #fff; }
.s-vtime { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }

.msg.sys { align-self: center; max-width: 92%; align-items: center; margin: 6px 0; }
.s-callentry { display: flex; align-items: center; gap: 10px; background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 8px 14px; text-align: left; font: inherit; color: var(--text); }
.s-callentry:hover { border-color: var(--blue); }
.s-callentry .ci { font-size: 20px; } .s-callentry b { display: block; font-size: 15px; } .s-callentry small { color: var(--muted); font-size: 12px; font-weight: 700; }
.s-callentry.missed b { color: var(--red-d); }
.s-callbtn { flex: none; width: 42px; height: 42px; border-radius: 50%; font-size: 20px; display: inline-flex; align-items: center; justify-content: center; }
.s-callbtn:hover { background: var(--soft); }

@keyframes ringout { from { transform: scale(1); opacity: 1; } to { transform: scale(1.45); opacity: 0; } }
@keyframes cbob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ---------------- Phase 3: Community ---------------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.c-page { padding-bottom: 40px; }
.c-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.c-head h1 { margin: 6px 0 12px; }
.c-bell { position: relative; font-size: 24px; width: 46px; height: 46px; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: 0 3px 0 var(--line); }
.c-bell:active { transform: translateY(2px); box-shadow: none; }
.c-bell .nbadge { top: -8px; right: -8px; }
.c-topbar { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.c-topbar h1 { margin: 6px 0; }
.c-composebar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: var(--muted); font-weight: 800; box-shadow: 0 3px 0 var(--line); }
.c-composebar .grow { flex: 1; min-width: 0; background: var(--soft); border: 2px solid var(--line); border-radius: 999px; padding: 9px 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-composebar:hover .grow { border-color: var(--line-d); }
.c-cb-ico { font-size: 20px; letter-spacing: 4px; }
.c-tabs { margin-top: 14px; }
.c-langs { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 6px; margin: 0 -2px 4px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.c-langs .s-chip { flex: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.c-pill { position: sticky; top: 12px; z-index: 5; display: block; margin: 6px auto 10px; padding: 9px 18px; border-radius: 999px; background: var(--blue); color: #fff; font-weight: 900; font-size: 15px; box-shadow: 0 4px 0 var(--blue-d), 0 8px 18px rgba(28,176,246,.25); }
.c-pill[hidden] { display: none; }
.c-feed { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.c-feed .card + .card { margin-top: 0; }
.c-post { padding: 14px 16px 8px; display: flex; flex-direction: column; gap: 10px; }
.c-ph { display: flex; align-items: center; gap: 10px; }
.c-ph .grow { flex: 1; min-width: 0; }
.c-name { font-weight: 900; color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-meta { color: var(--muted); font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-meta a { color: inherit; } .c-meta a:hover { text-decoration: underline; }
.c-dots { flex: none; width: 38px; height: 38px; border-radius: 12px; font-size: 22px; color: var(--muted); font-weight: 900; }
.c-dots:hover { background: var(--soft); }
.c-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.c-tags .s-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 3px 10px; }
.c-type { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 900; padding: 4px 10px; border-radius: 999px; border: 2px solid transparent; }
.c-type.t-question { background: var(--blue-l); color: var(--blue-d); border-color: #84d8ff; }
.c-type.t-practice { background: #f3e6ff; color: var(--purple-d); border-color: #dcb6ff; }
.c-type.t-tip { background: #fff3d6; color: var(--orange-d); border-color: #ffd98a; }
.c-body { margin: 0; font-size: 17px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; cursor: pointer; color: var(--text); }
.c-body.full { cursor: auto; font-size: 18px; }
.c-body a { color: var(--blue-d); text-decoration: underline; }
.c-readmore { color: var(--blue-d); font-weight: 900; }
.c-imgs { display: grid; gap: 4px; border-radius: 14px; overflow: hidden; }
.c-imgs.n1 { grid-template-columns: 1fr; }
.c-imgs.n2 { grid-template-columns: 1fr 1fr; }
.c-imgs.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.c-imgs.n3 .c-img:first-child { grid-row: span 2; }
.c-imgs.n4 { grid-template-columns: 1fr 1fr; }
.c-img { display: block; padding: 0; border: 0; background: var(--soft); aspect-ratio: 1; overflow: hidden; cursor: zoom-in; position: relative; }
.c-imgs.n1 .c-img { aspect-ratio: 4 / 3; max-height: 480px; width: 100%; }
.c-imgs.n3 .c-img:first-child { aspect-ratio: auto; }
.c-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.c-img.broken::after { content: '🖼️ Picture unavailable'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 800; font-size: 14px; }
.c-voice { background: var(--soft); border: 2px solid var(--line); border-radius: 14px; padding: 8px 12px; }
.c-actions { display: flex; gap: 4px; border-top: 2px solid var(--line); padding-top: 6px; margin: 0 -6px; }
.c-actions > * { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; border-radius: 12px; color: var(--muted); font-weight: 900; font-size: 15px; }
.c-actions > *:hover { background: var(--soft); }
.c-actions .e { font-size: 18px; }
.c-like.on { color: var(--red-d); }
.c-like.pop .e { animation: cpop .35s ease-out; }
@keyframes cpop { 0% { transform: scale(1); } 45% { transform: scale(1.45); } 100% { transform: scale(1); } }
.c-more { display: flex; justify-content: center; padding: 18px 0 6px; min-height: 30px; }
.c-uposts { margin-top: 26px !important; }
.c-join { margin-top: 20px; }
.c-join .btn { min-width: 0; width: 100%; max-width: 320px; }
/* post detail + comments */
.c-detail .c-post { border-color: var(--line-d); }
.c-comments { margin-top: 14px; padding: 14px 14px 10px; }
.c-comments h2 { margin: 0 0 12px; font-size: 19px; }
.c-nocmt { margin: 4px 0 8px; }
.c-cmt { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; border-radius: 14px; }
.c-cmt .grow { flex: 1; min-width: 0; }
.c-bubble { background: var(--soft); border: 2px solid var(--line); border-radius: 4px 16px 16px 16px; padding: 8px 12px; display: inline-block; max-width: 100%; }
.c-bubble .c-name { font-size: 14px; white-space: normal; }
.c-bubble p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; line-height: 1.45; }
.c-bubble a:not(.c-name) { color: var(--blue-d); text-decoration: underline; }
.c-cact { display: flex; align-items: center; gap: 4px; font-size: 13px; padding: 2px 4px; }
.c-cact button { font-weight: 900; color: var(--muted); font-size: 13px; padding: 4px 8px; border-radius: 8px; }
.c-cact button:hover { background: var(--soft); color: var(--text); }
.c-replies { margin-top: 8px; }
.c-cmt.reply { margin-bottom: 8px; }
.c-cmt.flash > .grow > .c-bubble { animation: cflash 1.8s ease-out; }
@keyframes cflash { 0%, 40% { background: var(--green-l); border-color: var(--green); } 100% { background: var(--soft); border-color: var(--line); } }
.c-cform { position: sticky; bottom: 0; z-index: 4; margin: 14px -16px 0; padding: 10px 16px calc(10px + var(--safe-b)); background: var(--card); border-top: 2px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 699px) { .c-cform { bottom: calc(54px + var(--safe-b)); padding-bottom: 10px; } }
.c-crow { display: flex; align-items: flex-end; gap: 8px; }
.c-crow textarea { flex: 1; resize: none; font: inherit; font-weight: 700; font-size: 16px; border: 2px solid var(--line); background: var(--soft); border-radius: 20px; padding: 9px 14px; max-height: 160px; min-height: 42px; color: var(--text); }
.c-crow textarea:focus { border-color: var(--blue); background: var(--card); outline: none; }
.c-crow .btn { flex: none; }
.c-replying { display: flex; align-items: center; justify-content: space-between; background: var(--blue-l); color: var(--blue-d); border-radius: 12px; padding: 6px 10px 6px 14px; font-weight: 800; font-size: 14px; }
.c-replying[hidden] { display: none; }
.c-replying button { font-weight: 900; padding: 2px 8px; color: var(--blue-d); }
/* notifications */
.c-notifs { padding: 4px; }
.c-notif { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; color: var(--text); }
.c-notif:hover { background: var(--soft); }
.c-notif + .c-notif { border-top: 2px solid var(--line); border-top-left-radius: 0; border-top-right-radius: 0; }
.c-notif.unread { background: #f1fbe9; }
.c-notif .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.c-snip { color: var(--muted); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-when { font-size: 13px; font-weight: 700; }
.c-nicon { flex: none; font-size: 22px; }
/* compose */
.c-compose .s-form { gap: 16px; }
.c-who { align-items: center; gap: 12px; }
.c-bodyfield { position: relative; }
.c-bodyfield textarea { min-height: 120px; font-size: 18px !important; line-height: 1.5; resize: none !important; }
.c-count { align-self: flex-end; }
.c-types { display: flex; flex-wrap: wrap; gap: 8px; }
.c-tpick { display: inline-flex; align-items: center; gap: 4px; font-size: 15px; }
.c-tpick input { position: absolute; opacity: 0; pointer-events: none; }
.c-tpick:focus-within { outline: 3px solid #84d8ff; outline-offset: 1px; }
.c-media { display: flex; flex-direction: column; gap: 12px; }
.c-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.c-thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 2px solid var(--line); }
.c-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.c-thumb button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-weight: 900; font-size: 13px; }
.c-addimg { aspect-ratio: 1; border: 2px dashed var(--line-d); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 24px; color: var(--muted); background: var(--soft); }
.c-addimg span { font-size: 12px; font-weight: 900; } .c-addimg small { font-size: 11px; font-weight: 800; }
.c-addimg:hover { border-color: var(--blue); color: var(--blue); }
.c-rec { display: flex; align-items: center; gap: 12px; border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; background: var(--soft); min-height: 64px; flex-wrap: wrap; }
.c-mic { flex: none; width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 21px; background: var(--blue); color: #fff; box-shadow: 0 3px 0 var(--blue-d); touch-action: none; user-select: none; -webkit-user-select: none; }
.c-rec-idle { font-size: 14px; font-weight: 700; }
.c-recbar { display: none; align-items: center; gap: 10px; flex: 1; font-weight: 900; flex-wrap: wrap; }
.c-rec.recording .c-recbar { display: flex; } .c-rec.recording .c-rec-idle { display: none; }
.c-rec.recording .c-mic { background: var(--red); box-shadow: 0 3px 0 var(--red-d); animation: recpulse 1.2s ease-in-out infinite; }
.c-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: recpulse 1.2s ease-in-out infinite; }
.c-rechint { color: var(--muted); font-size: 13px; flex: 1; }
.c-tap-only { display: none !important; }
.c-rec.rec-tap .c-tap-only { display: inline-flex !important; } .c-rec.rec-tap .c-rechint { display: none; }
.c-clip { display: flex; align-items: center; gap: 10px; border: 2px solid var(--line); border-radius: 14px; padding: 8px 12px; background: var(--soft); }
.c-clip .s-voice { flex: 1; min-width: 0; }
.c-editnote { margin: 0; font-size: 14px; }
.c-linkbox { width: 100%; font: inherit; font-weight: 700; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; margin: 6px 0 12px; }
@media (max-width: 420px) { .c-post { padding: 12px 12px 6px; } .c-actions > * { font-size: 14px; } .c-share span:last-child { display: none; } .c-thumbs { grid-template-columns: repeat(4, 1fr); gap: 6px; } }
@media (prefers-reduced-motion: reduce) { .c-like.pop .e, .c-cmt.flash > .grow > .c-bubble, .c-rec.recording .c-mic, .c-dot { animation: none; } }

/* ---------- Dark mode (html[data-theme="dark"], set by theme.js) ---------- */
html[data-theme="dark"] {
  color-scheme: dark;
  --text: #f1f7fb; --muted: #a3b4be; --line: #37464f; --line-d: #2a3942; --bg: #131f24; --card: #131f24; --soft: #1d2c33;
  --green-l: #1e3a14; --blue-l: #0f3346; --red-l: #3f1e23;
  --t-purple: #2f2342; --t-orange: #3a2b14; --t-green: #1a2f19; --bubble-them: #233640;
}
html[data-theme="dark"], html[data-theme="dark"] body { background: var(--bg); }
html[data-theme="dark"] input, html[data-theme="dark"] textarea, html[data-theme="dark"] select { color: var(--text); }
html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder { color: #7f939e; }
html[data-theme="dark"] .btn:disabled { color: #8a9ba5; }
html[data-theme="dark"] .icon-btn, html[data-theme="dark"] .section-divider, html[data-theme="dark"] .progress-label, html[data-theme="dark"] .choice .k { color: #8fa2ad; }
html[data-theme="dark"] .node.locked { color: #8a9ba5; }
html[data-theme="dark"] .tok { border-bottom-color: #556670; }
html[data-theme="dark"] .choice.gone { color: #6f818b; } html[data-theme="dark"] .choice.gone .roman { color: #5b6b74; }
html[data-theme="dark"] .navbtn.active, html[data-theme="dark"] .course-tile.sel, html[data-theme="dark"] .goal-opt.sel, html[data-theme="dark"] .choice.sel, html[data-theme="dark"] .choice.sel .k { border-color: #2f8fc4; }
html[data-theme="dark"] .choice.right { border-color: #4f8f22; color: var(--green); }
html[data-theme="dark"] .choice.wrong, html[data-theme="dark"] .choice.wrong .k { border-color: #8f3a3f; color: #ff7b7b; }
html[data-theme="dark"] .feedback.ok { color: var(--green); }
html[data-theme="dark"] .feedback.bad { color: #ff7b7b; }
html[data-theme="dark"] .feedback .fb-h .badge { background: var(--bg); }
html[data-theme="dark"] .msg.them .bubble { background: var(--bubble-them); border-color: var(--bubble-them); }
html[data-theme="dark"] .bubble::before { background: var(--bubble-them); }
html[data-theme="dark"] .msg .status .bad { color: #ff7b7b; }
html[data-theme="dark"] .modal-bg { background: rgba(0,0,0,.65); }
html[data-theme="dark"] .modal, html[data-theme="dark"] .toast, html[data-theme="dark"] .tok-tip { background: var(--soft); }
html[data-theme="dark"] .popover { box-shadow: 0 8px 24px rgba(0,0,0,.5); }
html[data-theme="dark"] .tts-warn, html[data-theme="dark"] .s-soon { background: var(--t-orange); color: var(--orange); }
html[data-theme="dark"] .s-demo { background: var(--t-purple); color: var(--purple); }
html[data-theme="dark"] .c-type.t-question { color: var(--blue); border-color: #2f8fc4; }
html[data-theme="dark"] .c-type.t-practice { background: var(--t-purple); color: var(--purple); border-color: #5d4285; }
html[data-theme="dark"] .c-type.t-tip { background: var(--t-orange); color: var(--orange); border-color: #6e5120; }
html[data-theme="dark"] .c-notif.unread { background: var(--t-green); }
html[data-theme="dark"] .avatar { border-color: #2f8fc4; }
html[data-theme="dark"] .flag::after { box-shadow: inset 0 0 0 2px rgba(255,255,255,.14); }
html[data-theme="dark"] .practice-card .pc-t { color: var(--green); }
html[data-theme="dark"] .lb-row .rank.r2 { color: #b8c4cb; }

/* ---------- 5-tab nav, Learn card + Learn area, Connect (native speakers) ---------- */
@media (max-width: 699px) {
  .bottomnav .navbtn { flex: 1; min-width: 0; padding: 4px 2px; }
  .bottomnav .navbtn .e { font-size: 23px; }
  .bottomnav .navbtn .lbl { display: block; font-size: 10.5px; text-transform: none; letter-spacing: 0; white-space: nowrap; font-weight: 800; }
}
.learn-card { display: flex; align-items: center; gap: 14px; margin: 0 0 18px; padding: 14px 14px 14px 12px; border-radius: 20px; color: #fff; text-decoration: none; background: linear-gradient(135deg, #58cc02 0%, #46a302 100%); box-shadow: 0 5px 0 #3f8c02; transition: transform .06s, box-shadow .06s; }
.learn-card:active { transform: translateY(4px); box-shadow: 0 1px 0 #3f8c02; }
.learn-card .lc-art { position: relative; flex: none; width: 74px; height: 74px; border-radius: 18px; background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center; }
.learn-card .lc-art .mascot { width: 62px; height: 62px; }
.learn-card .lc-flag { position: absolute; right: -6px; bottom: -6px; border: 3px solid #4cb302; border-radius: 50%; display: flex; }
.learn-card .lc-flag .flag { width: 28px; height: 28px; }
.learn-card .lc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.learn-card .lc-k { font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: 1.2px; opacity: .9; }
.learn-card .lc-t { font-size: 21px; font-weight: 900; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.learn-card .lc-t small { font-size: 13px; font-weight: 800; opacity: .9; margin-left: 4px; }
.learn-card .lc-stats { display: flex; gap: 12px; font-size: 14px; font-weight: 800; }
.learn-card .lc-goal { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 800; }
.learn-card .lc-bar { flex: 1; height: 10px; border-radius: 99px; background: rgba(0,0,0,.18); overflow: hidden; max-width: 160px; }
.learn-card .lc-bar i { display: block; height: 100%; background: #ffc800; border-radius: 99px; }
.learn-card .lc-gl { white-space: nowrap; }
.learn-card .lc-go { flex: none; font-size: 34px; font-weight: 900; opacity: .9; }
.learn-head { display: flex; align-items: center; gap: 10px; margin: 2px 0 10px; }
.learn-head h1 { margin: 0; font-size: 24px; }
.learn-head .lh-back { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px 6px 8px; border: 2px solid var(--line); border-bottom-width: 3px; border-radius: 12px; color: var(--text); font-weight: 900; font-size: 18px; text-decoration: none; }
.learn-head .lh-back span { font-size: 14px; }
.learn-tabs { margin: 0 0 16px; } .learn-tabs a { flex: 1; text-align: center; padding: 9px 6px; font-size: 15px; color: var(--muted); font-weight: 800; text-decoration: none; } .learn-tabs a.on { background: var(--green-l); color: var(--green-d); }
.learn-tabs + .page, .learn-head ~ .page { padding-top: 0; }
.cn-head { margin-bottom: 4px; }
.cn-intro { margin: 4px 0 10px; }
.cn-chips { max-height: none; margin-bottom: 4px; }
.cn-chips .s-chip { cursor: pointer; color: var(--muted); }
.cn-chips .s-chip.on { border-color: #84d8ff; background: var(--blue-l); color: var(--blue); }
.cn-list { display: flex; flex-direction: column; gap: 12px; }
.cn-card { padding: 14px; }
.cn-top { display: flex; gap: 12px; align-items: flex-start; color: var(--text); text-decoration: none; }
.cn-top .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cn-top b { font-size: 17px; }
.cn-sub, .cn-act { font-size: 13px; }
.cn-on { color: var(--green-d); font-weight: 900; }
.cn-badge { align-self: flex-start; font-size: 12px; font-weight: 900; color: var(--green-d); background: var(--green-l); border-radius: 8px; padding: 2px 8px; margin-top: 2px; }
.cn-langs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.cn-l { font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); min-width: 66px; }
.cn-lang { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 800; padding: 2px 9px 2px 3px; border-radius: 999px; border: 2px solid var(--line); }
.cn-lang.sp { border-color: #a5ed6e; }
.cn-bio { margin: 10px 0 0; font-size: 15px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.cn-btns { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.cn-btns .btn { flex: 1; min-width: 0; padding: 0 8px; }
html[data-theme="dark"] .cn-lang.sp { border-color: #3d6b1f; }
html[data-theme="dark"] .cn-on, html[data-theme="dark"] .cn-badge, html[data-theme="dark"] .learn-tabs a.on { color: #8ee04a; }
html[data-theme="dark"] .learn-card { background: linear-gradient(135deg, #46a302 0%, #3a8a02 100%); box-shadow: 0 5px 0 #2c6a01; }
.learn-top { max-width: 620px; margin: 0 auto; padding: 14px 16px 0; }
.learn-top .practice-card { margin: 0; }
.learn-top + .page { padding-top: 0; }
.learn-top + .page > h1:first-child { margin-top: 0; }

/* ---------- Navbar rules: the bottom bar shows only on the main tab pages ---------- */
@media (max-width: 699px) {
  body.nav-off .bottomnav { display: none; }
  body.nav-off .main { padding-bottom: calc(16px + var(--safe-b)); }
  body.nav-off .c-cform { bottom: 0; padding-bottom: calc(10px + var(--safe-b)); }
  body.nav-off.rm-mini-on .main { padding-bottom: calc(70px + var(--safe-b)); }
}
.subbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 4px; padding: 8px 10px 6px; background: var(--card); border-bottom: 2px solid var(--line); }
.subbar .s-back { padding: 0 10px 4px 4px; }
.subbar .sb-t { font-size: 18px; font-weight: 900; }
body.ll-gated .subbar { display: none; }
.lh-back { position: relative; }
.lh-back .nbadge { position: static; margin-left: 4px; vertical-align: middle; }
/* Section cards on Chats (small, horizontally scrolling, more can be added) */
.sec-cards { display: flex; gap: 10px; overflow-x: auto; margin: 0 -2px 14px; padding: 2px 2px 6px; scrollbar-width: none; }
.sec-cards::-webkit-scrollbar { display: none; }
.sec-card { flex: none; display: flex; align-items: center; gap: 8px; min-width: 128px; max-width: 170px; padding: 8px 12px 8px 8px; border-radius: 14px; color: #fff; text-decoration: none; background: linear-gradient(135deg, #58cc02 0%, #46a302 100%); box-shadow: 0 3px 0 #3f8c02; transition: transform .06s, box-shadow .06s; }
.sec-card:active { transform: translateY(2px); box-shadow: 0 1px 0 #3f8c02; }
.sec-card .sc-ico { flex: none; width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.sec-card .sc-body { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.sec-card .sc-t { font-size: 15px; font-weight: 900; line-height: 1.1; }
.sec-card .sc-sub { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.sec-card .sc-sub .flag.sm { width: 18px; height: 18px; }
.sec-card .sc-streak.off { opacity: .75; }
html[data-theme="dark"] .sec-card { background: linear-gradient(135deg, #46a302 0%, #3a8a02 100%); box-shadow: 0 3px 0 #2c6a01; }
/* Connect: compact rows */
.cn-legend { margin: 0 0 8px; font-size: 12.5px; font-weight: 700; }
.cn-list { gap: 8px; }
.cn-card { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 12px; }
.cn-card .cn-top { flex: 1; min-width: 0; align-items: center; gap: 12px; }
.cn-av { position: relative; flex: none; display: inline-flex; }
.cn-cflag { position: absolute; left: -4px; bottom: -3px; width: 22px; height: 22px; border-radius: 50%; background: var(--card); border: 2px solid var(--card); display: flex; align-items: center; justify-content: center; font-size: 15px; line-height: 1; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.cn-card .cn-top b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cn-card .cn-badge { font-size: 12px; padding: 0 4px; margin: 0; border-radius: 6px; vertical-align: 1px; }
.cn-status { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cn-card .cn-langs { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; margin-top: 3px; overflow: hidden; white-space: nowrap; }
.cn-sym { font-size: 14px; line-height: 1; }
.cn-sym.lrn { margin-left: 4px; }
.cn-code { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 900; color: var(--text); }
.cn-code .flag.sm { width: 17px; height: 17px; }
.cn-msg { flex: none; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; background: var(--blue-l); border: 2px solid #84d8ff; color: var(--blue); cursor: pointer; }
.cn-msg:active { transform: translateY(1px); }
html[data-theme="dark"] .cn-msg { border-color: #1f6f99; }
html[data-theme="dark"] .cn-cflag { box-shadow: 0 1px 2px rgba(0,0,0,.6); }
/* ---------- UI polish: round flags, names with badges, profile, post page, call screen ---------- */
/* Round flags: emoji flag clipped to a circle. --s is the diameter. */
.rflag { --s: 22px; position: relative; display: inline-flex; flex: none; align-items: center; justify-content: center; width: var(--s); height: var(--s); border-radius: 50%; overflow: hidden; background: var(--soft); vertical-align: middle; isolation: isolate; }
.rflag i { font-style: normal; display: block; font-size: calc(var(--s) * 1.32); line-height: 1; letter-spacing: 0; font-family: 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif; }
.rflag.none i { font-size: calc(var(--s) * .8); }
.rflag::after { content: ''; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.14); pointer-events: none; }
.avf { position: relative; display: inline-flex; flex: none; vertical-align: middle; border-radius: 50%; }
.rflag.av { position: absolute; left: -1px; bottom: -1px; box-shadow: 0 0 0 2px var(--ring, var(--card)), 0 1px 3px rgba(0,0,0,.25); z-index: 1; }
html[data-theme="dark"] .rflag::after { box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
/* Name + VIP badge + Demo: only the name is cut off */
.nmw { display: inline-flex; align-items: center; gap: .3em; max-width: 100%; min-width: 0; vertical-align: bottom; }
.nmt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nmw > .vip-b, .nmw > .s-demo { flex: none; }
.nmw > .s-demo { font-size: max(9px, .6em); padding: .15em .5em; line-height: 1.2; }
.s-conv b, .s-person b, .chathead .s-who b, .cn-card .cn-top b { display: flex; min-width: 0; max-width: 100%; }
.chathead .s-who > span.s-whot { display: flex; flex-direction: column; min-width: 0; }
.s-conv .row.between > b { flex: 1; }
.cn-card .cn-top b.row { gap: 4px; flex-wrap: nowrap; }
.c-name .nmw { max-width: 100%; }
.pf-name .nmw { flex-wrap: wrap; justify-content: center; white-space: normal; }
.pf-name .nmt { white-space: normal; word-break: break-word; }

/* Profile */
.pf-head { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 6px 0 4px; }
.pf-head > .avf, .pf-head > .sav { margin-bottom: 10px; }
.pf-head .rflag.av { left: 2px; bottom: 2px; }
.pf-name { margin: 0 !important; font-size: 24px !important; line-height: 1.2; max-width: 100%; }
.pf-user { margin-top: 2px; font-size: 15px; font-weight: 700; }
.pf-bio { margin: 10px 0 0; max-width: 34em; font-size: 15.5px; font-weight: 700; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
a.pf-bio { font-weight: 700; text-decoration: underline dotted; }
.pf-stats { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; max-width: 360px; margin: 16px auto 0; border: 2px solid var(--line); border-radius: 16px; overflow: hidden; }
.pf-stat { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; color: var(--muted); font-size: 13px; font-weight: 800; }
.pf-stat + .pf-stat { border-left: 2px solid var(--line); }
.pf-stat b { color: var(--text); font-size: 18px; font-weight: 900; }
a.pf-stat:active { background: var(--soft); }
.pf-langs { margin-top: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.pf-langs h2 { margin: 0; font-size: 15px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.pf-lrow { display: grid; grid-template-columns: 92px 1fr; align-items: start; gap: 8px; }
.pf-lk { display: inline-flex; align-items: center; gap: 6px; padding-top: 6px; font-size: 14px; font-weight: 900; color: var(--muted); }
.pf-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.pf-chips .small { padding-top: 6px; font-size: 14px; }
.pf-chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px 0 5px; border: 2px solid var(--line); border-radius: 999px; background: var(--card); font-size: 14px; font-weight: 800; color: var(--text); white-space: nowrap; }
.pf-chip small { color: var(--muted); font-size: 12px; font-weight: 800; }
.pf-chip.pf-lock { padding: 0 10px; border-style: dashed; color: var(--muted); background: transparent; font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; opacity: .8; }
.pf-actions { display: flex; gap: 8px; margin-top: 14px; }
.pf-actions .btn { flex: 1; min-height: 44px; padding: 0 12px; font-size: 14px; white-space: nowrap; margin: 0; }
.pf-actions .pf-more, .pf-actions .pf-ico { flex: none; width: 48px; padding: 0; }
.pf-mini { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin: 14px 0 0; color: var(--muted); font-size: 14px; font-weight: 800; }
.pf-mini b { color: var(--text); }
.pf-ph { margin-top: 18px; } .pf-ph h2 { margin: 0; }
.pf-all { font-weight: 900; color: var(--blue); }
.pf .c-uposts { margin-top: 18px; }
.pf-ph .c-uposts { margin-top: 0; }
.pf-ph + .c-feed, .pf-ph + * { margin-top: 10px; }
@media (max-width: 360px) { .pf-lrow { grid-template-columns: 1fr; gap: 4px; } .pf-lk { padding-top: 0; } .pf-actions .btn { font-size: 13px; padding: 0 8px; } .pf-name { font-size: 22px !important; } }

/* Moments: the whole post opens its page */
.c-post.c-tap { cursor: pointer; }
.c-post.c-tap:active { border-color: var(--line-d); }
.c-detail .c-post { cursor: default; }

/* Call screen */
body.call-open { overflow: hidden; }
.call-ui { --call-top: #dff3ff; --call-bot: #ffffff; --ring: #f2faff; position: fixed; inset: 0; z-index: 400; display: flex; justify-content: center; padding: calc(12px + var(--safe-t, 0px)) 16px calc(20px + var(--safe-b)); background: linear-gradient(180deg, var(--call-top) 0%, var(--call-bot) 62%); color: var(--text); animation: fbup .2s ease-out; }
.call-ui.ph-incoming { --call-top: #e3f9d2; --ring: #f3fcec; }
.call-ui.ph-ended { --call-top: #eef1f3; --ring: #f6f8f9; }
html[data-theme="dark"] .call-ui { --call-top: #0f2c3b; --call-bot: #131f24; --ring: #11262f; }
html[data-theme="dark"] .call-ui.ph-incoming { --call-top: #183418; --ring: #16291c; }
html[data-theme="dark"] .call-ui.ph-ended { --call-top: #1f2b31; --ring: #19252b; }
.call-card { width: 100%; max-width: 420px; height: 100%; display: flex; flex-direction: column; align-items: center; text-align: center; }
.call-kicker { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.65); font-weight: 900; letter-spacing: .6px; text-transform: uppercase; font-size: 11.5px; color: var(--muted); }
html[data-theme="dark"] .call-kicker { background: rgba(255,255,255,.06); }
.call-mid { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px 0; }
.call-av { --cav: 128px; position: relative; margin-bottom: 18px; border-radius: 50%; }
.call-av .sav { width: var(--cav) !important; height: var(--cav) !important; font-size: calc(var(--cav) * .45) !important; box-shadow: 0 0 0 6px var(--ring), 0 8px 24px rgba(0,0,0,.12); }
.call-av .rflag.av { --s: calc(var(--cav) * .26) !important; left: 4%; bottom: 4%; box-shadow: 0 0 0 3px var(--ring), 0 1px 3px rgba(0,0,0,.25); }
.call-av.pulse::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 4px solid rgba(28,176,246,.45); animation: ringout 1.6s ease-out infinite; }
.ph-incoming .call-av.pulse::after { border-color: rgba(88,204,2,.5); }
.call-name { margin: 0; max-width: 100%; font-size: 28px; line-height: 1.2; color: var(--text); }
.call-name .nmw { max-width: 100%; }
.call-user { margin-top: 4px; color: var(--muted); font-weight: 800; font-size: 15px; }
.call-status { margin-top: 14px; min-height: 32px; display: inline-flex; align-items: center; gap: 8px; padding: 4px 14px; border-radius: 999px; background: rgba(28,176,246,.12); color: var(--blue-d); font-size: 17px; font-weight: 900; font-variant-numeric: tabular-nums; }
.call-status.live { background: rgba(88,204,2,.14); color: var(--green-d); }
.call-status.live::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
html[data-theme="dark"] .call-status { color: #6fd2ff; } html[data-theme="dark"] .call-status.live { color: #8ee04a; }
.call-note { margin: 16px 8px 0; background: var(--soft); border-radius: 14px; padding: 10px 14px; font-weight: 700; font-size: 14px; line-height: 1.4; color: var(--text); }
.call-actions { width: 100%; display: flex; justify-content: space-evenly; gap: 12px; padding: 8px 0 4px; }
.cbtn { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 72px; color: var(--muted); font: inherit; font-weight: 800; font-size: 13px; background: none; border: 0; cursor: pointer; }
.cbtn .ci { width: 66px; height: 66px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; transition: transform .1s, background .15s; }
.cbtn .ci svg { width: 28px; height: 28px; }
.cbtn:active .ci { transform: scale(.94); }
.cbtn.red .ci { background: var(--red); color: #fff; box-shadow: 0 4px 0 var(--red-d); }
.cbtn.green .ci { background: var(--green); color: #fff; box-shadow: 0 4px 0 var(--green-d); animation: cbob 1.4s ease-in-out infinite; }
.cbtn.soft .ci { background: var(--card); color: var(--text); box-shadow: inset 0 0 0 2px var(--line), 0 2px 6px rgba(0,0,0,.06); }
.cbtn.soft.on .ci { background: var(--text); color: var(--card); box-shadow: none; }
.cbtn:focus-visible .ci { outline: 3px solid var(--blue); outline-offset: 3px; }
.call-audio { display: none; }
@media (max-height: 640px) { .call-av { --cav: 96px; margin-bottom: 12px; } .call-name { font-size: 24px; } .call-status { margin-top: 10px; } .cbtn .ci { width: 58px; height: 58px; } }
@media (max-height: 520px) { .call-av { --cav: 72px; } .call-kicker { display: none; } }
@media (prefers-reduced-motion: reduce) { .call-av.pulse::after, .cbtn.green .ci, .composer.recording .s-mic { animation: none; } }
.rm-person .rflag.av { z-index: 2; }

/* push notifications: the one-time ask on Chats and the setting in Edit profile */
.ll-push-ask { position: fixed; left: 0; right: 0; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 350; display: flex; justify-content: center; padding: 0 12px; animation: lpaUp .25s ease; }
.ll-push-ask .lpa-card { width: 100%; max-width: 520px; background: var(--card); border: 2px solid var(--line); border-radius: 18px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 14px; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; }
.ll-push-ask .lpa-ic { font-size: 28px; }
.ll-push-ask .lpa-tx b { display: block; font-size: 16px; }
.ll-push-ask .lpa-tx span { display: block; font-size: 14px; color: var(--muted, #777); }
.ll-push-ask .lpa-btns { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
@keyframes lpaUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.s-push { margin-top: 22px; }
.s-push .setting { font-size: 16px; padding: 6px 0; }
.s-push .switch { border: 0; cursor: pointer; padding: 0; }
.s-push .switch:disabled { opacity: .5; cursor: not-allowed; }
html[data-theme="dark"] .ll-push-ask .lpa-card { background: var(--soft); }
/* notifications for all activity (1.12) */
.s-chead { display: inline-flex; align-items: center; gap: 12px; }
.s-bell { width: 42px; height: 42px; font-size: 21px; }
.c-markall { margin-left: auto; padding: 6px 8px; white-space: nowrap; }
.c-notif { position: relative; }
.c-notif .grow > span:first-child { overflow-wrap: anywhere; }
.c-nstack { position: relative; flex: none; width: 46px; height: 46px; }
.c-nstack > .av, .c-nstack > *:first-child { position: absolute; left: 0; top: 0; }
.c-nstack2 { position: absolute; right: -4px; bottom: -4px; border: 2px solid var(--card); border-radius: 50%; line-height: 0; background: var(--card); }
.c-ndot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); }
.c-njoin { color: #fff; background: var(--green, #58cc02); border-radius: 999px; padding: 1px 8px; font-weight: 900; font-size: 12px; }
.c-nended { font-weight: 800; }
.c-nset { margin: 14px 0 4px; }
.s-ntypes { border-top: 2px solid var(--line); margin-top: 8px; padding-top: 8px; }
.s-ntypes-h { display: flex; flex-direction: column; gap: 2px; padding: 4px 0 6px; }
.s-push .s-ntype { font-size: 15px; gap: 10px; }
.s-push .s-ntype > span { min-width: 0; overflow-wrap: anywhere; }
