:root {
  --bg: #FBF4EA;
  --bg2: #F4E8D6;
  --card: #FFFDF9;
  --ink: #2B2340;
  --muted: #6E6577;
  --line: #E8DCCB;
  --terra: #C8553D;
  --terra-dark: #A8432F;
  --saffron: #E8A33D;
  --azul: #3D5A80;
  --ok: #2F7D6B;
  --radius: 18px;
  --shadow: 0 6px 22px rgba(43, 35, 64, .10);
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.4; }
body { min-height: 100dvh; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--azul); }
[hidden] { display: none !important; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 20px; letter-spacing: -.2px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.chip { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.link-btn { background: none; border: none; color: var(--azul); font-weight: 600; padding: 6px 4px; }

main { flex: 1; padding: 4px 16px 24px; }
.loading { text-align: center; color: var(--muted); padding: 60px 0; }
.foot { text-align: center; font-size: 13px; color: var(--muted); padding: 12px 16px 18px; }
.foot a { color: var(--muted); }

.banner { margin: 0 16px 10px; padding: 10px 14px; border-radius: 12px; background: #FFF0D6; border: 1px solid #F1D29B; font-size: 15px; }
.banner-tg { background: #E8EEF7; border-color: #C6D3E6; }
.banner .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

h1 { font-size: 30px; line-height: 1.15; margin: 12px 0 6px; letter-spacing: -.5px; }
h2 { font-size: 22px; margin: 18px 0 10px; }
h3 { font-size: 17px; margin: 14px 0 8px; }
.lead { color: var(--muted); margin: 0 0 18px; }
.small { font-size: 14px; color: var(--muted); }
.center { text-align: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; border-radius: 14px; padding: 13px 18px; font-weight: 700; background: var(--terra); color: #fff; min-height: 48px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; }
.btn.secondary { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); }
.btn.ghost { background: transparent; color: var(--azul); padding: 10px 12px; min-height: 40px; }
.btn.small { padding: 8px 12px; min-height: 36px; font-size: 15px; border-radius: 11px; }
.btn.block { width: 100%; }
.btn.tg { background: #2AABEE; }
.btn.danger { background: transparent; color: var(--terra-dark); border: 1.5px solid #E7B9AE; }

/* Entry */
.neighbours { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 18px; }
.nb { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 10px 8px 12px; text-align: center; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.nb:focus-visible, .nb:hover { border-color: var(--terra); }
.nb img { width: 100%; max-width: 120px; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 50%; background: var(--bg2); }
.nb .name { font-weight: 800; font-size: 18px; }
.nb .line { font-size: 13px; color: var(--muted); line-height: 1.25; flex: 1; }
.nb .talk-btn { width: 100%; min-height: 40px; padding: 8px 6px; font-size: 14px; line-height: 1.15; border-radius: 12px; margin-top: 4px; }
.levels.big .level-btn { padding: 18px 18px; font-size: 19px; font-weight: 700; border-radius: 16px; }
.level-line { font-size: 15px; color: var(--muted); margin: -6px 0 10px; text-align: center; }
.linklike { background: none; border: none; padding: 0; color: var(--azul); font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.trial-line { font-size: 14px; color: var(--muted); text-align: center; margin: 4px 0 12px; }
.levels { display: grid; gap: 8px; margin: 8px 0 16px; }
.level-btn { text-align: left; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; font-weight: 600; }
.level-btn[aria-pressed="true"] { border-color: var(--terra); background: #FCEBE4; }
.notice { background: var(--card); border: 1px dashed var(--line); border-radius: 14px; padding: 10px 12px; font-size: 14px; color: var(--muted); margin: 6px 0 14px; }

/* Talk: the neighbour's scene fills the screen (WebGL canvas); everything else floats over the
   foreground (the balcony wall, the seafront wall, the café table), which never turns transparent. */
body.talking { overflow: hidden; background: #E9DFD0; }
body.talking #app { height: 100dvh; min-height: 0; max-width: none; }
body.talking .foot, body.talking .topbar, body.talking .banner:not(#banner-offline) { display: none; }
body.talking #banner-offline { position: fixed; top: calc(8px + env(safe-area-inset-top) + var(--tg-top, 0px)); left: 0; right: 0; z-index: 20; }
body.talking main { padding: 0; min-height: 0; flex: 1; position: relative; }
.talk { position: absolute; inset: 0; overflow: hidden; display: flex; justify-content: center; }
/* Computer, tablet, landscape: the scene keeps the phone's proportions (the artist's 1080×2340) in the
   middle; the sides continue its background, blurred and a little darker. */
.talk .scene-col { position: relative; height: 100%; width: 100%; z-index: 1; }
/* A computer or a tablet (wider than 3:4): the scene keeps phone proportions in the middle, its own picture blurred at the sides. */
@media (min-aspect-ratio: 3/4) { .talk .scene-col { max-width: calc(100dvh * 0.4615); box-shadow: 0 0 40px rgba(43, 35, 64, .25); } }
.talk::before { content: ""; position: absolute; inset: -40px; background: var(--scene-bg, none) center / cover no-repeat, #E9DFD0; filter: blur(22px) brightness(.85) saturate(.9); transform: scale(1.06); }
.stage { position: absolute; inset: 0; overflow: hidden; background: #E9DFD0; touch-action: manipulation; }
.stage canvas.scene-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage img.portrait { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
/* Listening: a thin warm light along the edges of the screen; thinking: a slow pulse of it. */
.edge-glow { position: absolute; inset: 0; pointer-events: none; z-index: 2; box-shadow: inset 0 0 0 0 rgba(232, 163, 61, 0); transition: box-shadow .6s ease; }
.edge-glow[data-glow="listen"] { box-shadow: inset 0 0 18px 3px rgba(232, 163, 61, .55); }
.edge-glow[data-glow="think"] { box-shadow: inset 0 0 22px 4px rgba(232, 163, 61, .5); animation: edge 1.8s ease-in-out infinite; }
@keyframes edge { 50% { box-shadow: inset 0 0 30px 7px rgba(232, 163, 61, .7); } }
@media (prefers-reduced-motion: reduce) { .edge-glow[data-glow="think"] { animation: none; } }
/* "Роса · Севилья" at the meeting, then it goes. */
.who-pill { position: absolute; top: calc(14px + env(safe-area-inset-top) + var(--tg-top, 0px)); left: 50%; transform: translate(-50%, 0); z-index: 3; background: rgba(255, 253, 249, .88);
  border-radius: 999px; padding: 6px 16px; font-weight: 800; font-size: 17px; white-space: nowrap; box-shadow: 0 4px 16px rgba(43, 35, 64, .12); transition: opacity .8s ease, transform .8s ease; }
.who-pill.gone { opacity: 0; transform: translate(-50%, -8px); pointer-events: none; }
/* Everything the learner reads or taps sits over the foreground (the table, the rail, the wall), from its upper edge
   down; the neighbour and the place above it stay free (6.11 evening: a meeting, not a portrait). */
.over { position: absolute; left: 0; right: 0; bottom: 0; top: auto; z-index: 3; /* exact values set from the scene (placeOver) */ display: flex; flex-direction: column; gap: 6px;
  padding: 0 14px calc(10px + env(safe-area-inset-bottom) + var(--tg-bottom, 0px)); min-height: 0; }
.talk-mid { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; justify-content: flex-start; padding-top: 4px; gap: 6px; overscroll-behavior: contain; }
/* The neighbour's line: smaller and lighter than before (owner, 6.11 evening: the ear first, then the eye); its words
   come in as they are heard (app.js stepCap), so the card never runs ahead of the voice. */
.subs { padding: 8px 13px 9px; flex: none; text-align: left; background: rgba(255, 252, 246, .84); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border-radius: 16px; box-shadow: 0 3px 12px rgba(43, 35, 64, .10); border: 1px solid rgba(43, 35, 64, .08); }
.subs:has(.es:empty), .subs.concealed { display: none; }
.subs .es { font-size: calc(15px * var(--line-k, 1)); font-weight: 500; line-height: 1.38; cursor: pointer; color: #2B2340; letter-spacing: .1px; }
/* 8.11 (owner): the line 10–15 % smaller, medium weight; a long line scrolls in its own box, never over the neighbour. */
.subs { max-height: 34vh; overflow-y: auto; overscroll-behavior: contain; }
body[data-text-size="s"] { --line-k: .9; } body[data-text-size="l"] { --line-k: 1.18; }
.subs .es .w { animation: word-in .3s ease; }
.subs .es .w.pending { display: none; }
@keyframes word-in { from { opacity: 0; } }
.subs .es.filler { color: var(--muted); font-style: italic; font-weight: 400; }
.subs .ru { color: #5A5068; margin-top: 4px; font-size: calc(14px * var(--line-k, 1)); font-weight: 400; line-height: 1.3; }
/* A translation the app opened itself waits until the line has been heard. */
.subs.live.tr-wait .ru { display: none; }
.show-text { align-self: center; flex: none; background: rgba(255, 252, 246, .8); border: 1px solid rgba(43, 35, 64, .12); border-radius: 999px; padding: 6px 14px; font-size: 14px; font-weight: 600; color: #4A4060; min-height: 34px; }
.line-acts { display: flex; justify-content: center; gap: 8px; flex: none; }
.subs .note-ru, .subs .fix, .subs .tts-retry { text-align: center; }
.line-btn { background: rgba(255, 252, 246, .82); border: 1px solid rgba(43, 35, 64, .1); border-radius: 999px; padding: 4px 11px; font-size: 13.5px; font-weight: 600; color: #3A3247; min-height: 32px; }
.line-btn:disabled { opacity: .45; }
.subs .fix { margin-top: 5px; font-size: 14px; color: var(--azul); }
/* The Russian card (5.11: the voice is Spanish only; the note on a mistake or a hint is shown, never said). */
.subs .note-ru { margin-top: 6px; padding: 5px 9px; border-radius: 10px; background: #FFF4D6; color: #3B2A00; font-size: 14.5px; font-weight: 500; line-height: 1.3; }
.subs .tts-retry { margin-top: 6px; }
/* "Кармен услышала: …": small and pale, gone in a few seconds (6.11 evening). */
.mine { align-self: flex-end; max-width: 86%; background: rgba(255, 253, 249, .62); color: #4A4258; border-radius: 12px 12px 4px 12px; padding: 3px 9px; font-size: 13px; line-height: 1.3; flex: none; }
.mine .heard { font-size: 11.5px; color: var(--muted); margin-right: 4px; }
.mine { transition: opacity .8s; } .mine.fade { opacity: 0; pointer-events: none; }
.mine .tag { font-size: 11.5px; color: var(--muted); margin-left: 6px; background: rgba(255, 255, 255, .8); border-radius: 999px; padding: 1px 7px; }
.mine .redo { display: inline; margin-left: 6px; font-size: 12.5px; background: none; border: none; color: var(--azul); padding: 0; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.notice-box { background: rgba(255, 240, 214, .95); border: 1px solid #F1D29B; border-radius: 14px; padding: 7px 11px; font-size: 14px; flex: none; order: 3; }
.notice-box.paused-note { background: rgba(255, 252, 246, .9); border-color: rgba(43, 35, 64, .12); text-align: center; color: #4A4060; }
/* The neighbour's line first; a notice under it (it may scroll), the hint on top when open. */
.talk-mid .hint-panel { order: 0; } .talk-mid .mine { order: 1; } .talk-mid .subs { order: 2; } .talk-mid .show-text { order: 2; } .talk-mid > .btn { order: 4; }
.notice-box .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.notice-box.fade { transition: opacity .6s; opacity: 0; }
.hint-panel h2 { margin: 0 0 10px; }
.hint-panel .phrase { margin-bottom: 8px; }
.hint-again { display: flex; gap: 8px; margin: 6px 0 4px; flex-wrap: wrap; }
/* The bottom row: two tools, the state circle in the middle, two tools. */
.bar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; flex: none; gap: 2px; }
.bar-side { display: flex; justify-content: space-evenly; align-items: flex-start; min-width: 0; }
.tool { width: 66px; min-width: 0; flex: 0 1 66px; background: none; border: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; color: #4F4659; line-height: 1.1; }
.tool .cap { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool .ic { width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 253, 249, .9); border: 1.5px solid var(--line); display: grid; place-items: center; color: var(--ink); box-shadow: 0 2px 8px rgba(43, 35, 64, .08); }
.tool .ic svg { width: 19px; height: 19px; }
.tool[aria-pressed="true"] .ic { border-color: var(--terra); color: var(--terra-dark); }
.tool:disabled { opacity: .45; }
/* The state circle (owner, 6.11 evening): one live sign, readable from 1–2 m: green listens (the ring follows the
   learner's voice), amber thinks (three dots), blue speaks (bars on her voice), grey: paused or the mic is off. */
.orb-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; flex: none; padding-top: 10px; }
.orb { --c: #2F8A63; --lv: 0; position: relative; width: 78px; height: 78px; border-radius: 50%; border: 0; padding: 0; background: var(--c); color: #fff;
  box-shadow: 0 6px 20px rgba(43, 35, 64, .25); display: grid; place-items: center; transition: background-color .35s ease; touch-action: manipulation; }
.orb:disabled { opacity: .55; }
.orb[data-s="listen"] { --c: #2F8A63; }
.orb[data-s="think"] { --c: #E0952B; }
.orb[data-s="speak"] { --c: #3D6AA8; }
.orb[data-s="paused"], .orb[data-s="off"] { --c: #8E8698; }
.orb[data-s="tap"] { --c: var(--terra); }
.orb .orb-ring { position: absolute; inset: -9px; border-radius: 50%; border: 4px solid var(--c); opacity: 0; transform: scale(.9); transition: border-color .35s ease; pointer-events: none; }
.orb[data-s="listen"] .orb-ring { opacity: calc(.28 + var(--lv) * .6); transform: scale(calc(.94 + var(--lv) * .34)); }
.orb[data-s="think"] .orb-ring { opacity: .35; animation: orb-breathe 1.6s ease-in-out infinite; }
.orb[data-s="speak"] .orb-ring { opacity: calc(.2 + var(--lv) * .45); transform: scale(calc(.96 + var(--lv) * .16)); }
@keyframes orb-breathe { 50% { transform: scale(1.12); opacity: .12; } }
.orb .orb-core { position: relative; width: 40px; height: 40px; display: grid; place-items: center; }
.orb .orb-core > * { grid-area: 1 / 1; display: none; }
.orb .i-mic, .orb .i-pause, .orb .i-play { width: 34px; height: 34px; }
.orb[data-s="listen"] .i-mic, .orb[data-s="tap"] .i-mic, .orb[data-s="off"] .i-mic { display: block; }
.orb[data-s="paused"] .i-play { display: block; }
.orb[data-s="think"] .i-dots { display: flex; gap: 6px; align-items: center; }
.orb .i-dots i { width: 9px; height: 9px; border-radius: 50%; background: #fff; animation: orb-dot 1.1s ease-in-out infinite; }
.orb .i-dots i:nth-child(2) { animation-delay: .15s; } .orb .i-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes orb-dot { 0%, 70%, 100% { transform: translateY(0); opacity: .65; } 35% { transform: translateY(-7px); opacity: 1; } }
.orb[data-s="speak"] .i-bars { display: flex; gap: 4px; align-items: center; height: 34px; }
.orb .i-bars i { width: 5px; border-radius: 3px; background: #fff; height: calc(7px + var(--lv) * 24px); transition: height .08s linear; }
.orb .i-bars i:nth-child(1), .orb .i-bars i:nth-child(5) { height: calc(6px + var(--lv) * 10px); }
.orb .i-bars i:nth-child(2), .orb .i-bars i:nth-child(4) { height: calc(7px + var(--lv) * 18px); }
.orb[data-s="off"] .i-mic { opacity: .85; }
.orb.rec { --c: #2F8A63; }
.orb-label { font-size: 14px; font-weight: 800; color: #3A3247; text-align: center; min-height: 18px; white-space: nowrap; text-shadow: 0 0 6px rgba(255, 252, 246, .9), 0 0 2px rgba(255, 252, 246, 1); }
.orb-label[data-s="listen"] { color: #23704F; } .orb-label[data-s="think"] { color: #9A5F0C; } .orb-label[data-s="speak"] { color: #2D5288; }
@media (prefers-reduced-motion: reduce) { .orb .i-dots i, .orb .orb-ring { animation: none !important; } }
/* The state is shown by the circle; this text stays for screen readers (and tests). */
.state { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; white-space: nowrap; }
.state .dot { display: none; }
.edge-glow { display: none; }
/* The microphone's phase for screen readers and tests: the circle shows it. */
.hf-signal { display: none; }
.mic-label { font-size: 14px; color: #5E5468; text-align: center; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; color: #23704F; }
.rule { font-size: 12.5px; color: var(--muted); text-align: center; }
/* Carmen's chalkboard: a tap shows today's menu, readable. */
.board-hit { position: absolute; z-index: 2; background: none; border: none; padding: 0; }
.menu-card { font-family: "VecinosChalk", var(--font); background: #2F3236; color: #F4F1E8; border-radius: 16px; padding: 14px 18px; text-align: center; }
.menu-card h2 { margin: 0 0 6px; font-size: 30px; } .menu-card .k { opacity: .75; margin-top: 8px; font-size: 20px; } .menu-card .d { font-size: 22px; line-height: 1.25; }
@media (max-height: 640px) {
  .orb { width: 66px; height: 66px; } .orb .i-mic, .orb .i-pause, .orb .i-play { width: 28px; height: 28px; }
  .subs .es { font-size: calc(14.5px * var(--line-k, 1)); } .subs .ru { font-size: calc(13.5px * var(--line-k, 1)); } .tool .ic { width: 36px; height: 36px; }
}
@media (max-width: 350px) { .orb { width: 66px; height: 66px; } .tool { font-size: 10.5px; } .over { padding-left: 8px; padding-right: 8px; } }
.pair { padding: 4px 0; } .pair .ru { color: var(--muted); }

/* Hint sheet / card */
.sheet { position: fixed; inset: 0; background: rgba(43, 35, 64, .35); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.sheet-card { background: var(--bg); width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 88dvh; overflow: auto; }
.sheet-card { position: relative; }
.sheet-card h2 { margin-top: 2px; padding-right: 44px; }
.sheet-close { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer; }
.sheet-close:focus-visible { outline: 3px solid var(--accent, #c85a3c); }
.phrase { background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; }
.phrase .k { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.phrase .es { font-size: 18px; font-weight: 700; margin: 2px 0; }
.phrase .ru { color: var(--muted); font-size: 15px; }
.phrase .row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

.card-box { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); margin-bottom: 12px; }
.corr .from { text-decoration: line-through; text-decoration-color: rgba(200, 85, 61, .6); color: var(--muted); }
.corr .to { font-weight: 800; font-size: 18px; margin: 2px 0; }
.corr .why { font-size: 15px; color: var(--muted); }
.corr .fb { display: flex; gap: 8px; margin-top: 8px; }
.corr .fb button { font-size: 13px; padding: 5px 10px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--bg); }
.corr .fb button[aria-pressed="true"] { border-color: var(--azul); background: #E8EEF7; }
.corr .tag { font-size: 12px; background: #E8EEF7; color: var(--azul); border-radius: 999px; padding: 1px 8px; margin-left: 6px; font-weight: 700; }
.good { border-left: 4px solid var(--ok); }
.stats-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 15px; }
.rate { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Profile */
.list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; }
.item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: none; }
.item .v { color: var(--muted); text-align: right; }
.item.col { flex-direction: column; align-items: stretch; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg button { border: 1.5px solid var(--line); background: var(--bg); border-radius: 10px; padding: 8px 4px; font-size: 13.5px; font-weight: 700; }
.seg button[aria-pressed="true"] { border-color: var(--terra); background: #FCEBE4; }
.switch { appearance: none; width: 48px; height: 28px; border-radius: 999px; background: #D8CFC4; position: relative; transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .2s; }
.switch:checked { background: var(--ok); }
.switch:checked::after { left: 23px; }
input[type="email"], input[type="text"], input[type="time"], input[inputmode="numeric"] { font: inherit; width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); }
.stack { display: grid; gap: 10px; }
.mem-item { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.mem-item:last-child { border-bottom: none; }
.mem-item button { background: none; border: none; color: var(--terra-dark); font-size: 14px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 60; max-width: 90vw; font-size: 15px; }
.pay-list { margin: 8px 0 16px; padding-left: 18px; }
.pay-list li { margin-bottom: 6px; }
.price { font-size: 28px; font-weight: 800; }

@media (min-width: 600px) { .neighbours { gap: 16px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.inline-form { display: flex; gap: 8px; align-items: stretch; }
.inline-form input { flex: 1; min-width: 0; }
.inline-form .btn { flex: none; padding: 10px 14px; }
/* The build in the corner: small, out of the way, never over a button. */
.build-tag { position: fixed; right: 6px; bottom: calc(2px + env(safe-area-inset-bottom)); font-size: 10px; line-height: 1; color: var(--muted); opacity: .6; pointer-events: none; z-index: 5; font-variant-numeric: tabular-nums; }

/* The news card (owner, 6.11): the Russian headline and the Spanish words of the news, over the top of the scene;
   it folds to one line with a tap. The same card carries an AEMET warning and its words. */
.news-card { position: absolute; top: calc(10px + env(safe-area-inset-top) + var(--tg-top, 0px)); left: 10px; right: 10px; z-index: 4; background: rgba(255, 252, 246, .96);
  border-radius: 16px; padding: 8px 10px 8px 12px; box-shadow: 0 6px 20px rgba(43, 35, 64, .18); border: 1px solid rgba(43, 35, 64, .12); font-size: 14px; line-height: 1.3; max-height: 34%; overflow-y: auto; }
.news-card .nc-head { display: flex; gap: 8px; align-items: flex-start; }
.news-card .nc-ic { flex: none; }
.news-card .nc-title { flex: 1 1 auto; font-weight: 800; font-size: 15px; }
.news-card .nc-toggle { flex: none; border: 0; background: transparent; font-size: 18px; line-height: 1; padding: 0 2px; color: #4A4060; cursor: pointer; transition: transform .2s; }
.news-card .nc-words { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 6px; }
.news-card .w { background: #F3EBDD; border-radius: 10px; padding: 1px 7px; font-size: 13px; }
.news-card .w b { font-weight: 800; color: #2B2340; }
.news-card .w span { color: #5A5170; }
.news-card .nc-who { margin-top: 6px; font-size: 13px; color: #5A5170; }
.news-card .nc-who .link { border: 0; background: transparent; color: #B4532A; font-weight: 700; text-decoration: underline; padding: 0 4px; font-size: 13px; cursor: pointer; }
.news-card .nc-foot { margin-top: 4px; font-size: 12px; color: #6D6480; }
.news-card.closed { right: auto; max-width: calc(100% - 20px); padding: 5px 10px; cursor: pointer; }
.news-card.closed .nc-title { font-size: 13.5px; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.news-card.closed .nc-words, .news-card.closed .nc-who, .news-card.closed .nc-foot { display: none; }
.news-card.closed .nc-toggle { transform: rotate(-90deg); }
.scene-col:has(.news-card) .who-pill { display: none; }
/* Sources of the weather data, as their terms ask: small, in the corner of the scene. */
.scene-credit { position: absolute; right: 8px; top: calc(4px + env(safe-area-inset-top) + var(--tg-top, 0px)); z-index: 2; font-size: 10px; color: rgba(255, 255, 255, .85); text-shadow: 0 1px 2px rgba(0, 0, 0, .45); pointer-events: none; }
.news-card .nc-credit { margin-top: 3px; font-size: 10px; color: #8A8198; }
.news-home { margin-bottom: 12px; }

/* «Как сказать?» (owner, 7.11): the sheet, the phrase kept over the talk, the praise for a mistake put right. */
.howto .howto-status { margin: 0 0 10px; font-weight: 600; }
.howto .howto-rec { margin: 6px 0 12px; }
.howto .heard { color: var(--muted); font-size: 14px; font-style: italic; margin-bottom: 4px; }
.howto .howto-phrase .es { font-size: 22px; }
.howto .inline-form { margin-top: 4px; }
.howto-wave { display: flex; gap: 6px; justify-content: center; height: 28px; align-items: center; margin: 4px 0 8px; }
.howto-wave span { width: 8px; height: 8px; border-radius: 4px; background: var(--accent, #2e7d32); animation: howto-w 0.9s ease-in-out infinite; }
.howto-wave span:nth-child(2) { animation-delay: .15s; } .howto-wave span:nth-child(3) { animation-delay: .3s; }
@keyframes howto-w { 0%, 100% { height: 8px; } 50% { height: 26px; } }
.howto-wait { text-align: center; font-size: 28px; letter-spacing: 4px; color: var(--muted); }
.howto-card { order: 0; position: relative; background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 8px 34px 8px 12px; margin-bottom: 8px; }
.howto-card .k { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.howto-card .es { font-size: 20px; font-weight: 800; margin: 2px 0; }
.howto-card .ru { color: var(--muted); font-size: 14px; }
.howto-card .howto-x { position: absolute; top: 4px; right: 6px; border: 0; background: none; font-size: 16px; color: var(--muted); padding: 6px; cursor: pointer; }
.praise { position: absolute; left: 50%; top: calc(var(--tg-top, 0px) + 64px); transform: translateX(-50%); z-index: 6; max-width: min(92%, 420px);
  background: var(--card); border: 2px solid #43a047; border-radius: 14px; padding: 8px 14px; box-shadow: 0 6px 20px rgba(0,0,0,.15); text-align: center; transition: opacity .6s; }
.praise.gone { opacity: 0; }
.card-more { margin: 8px 0; } .card-more > summary { cursor: pointer; font-weight: 700; color: var(--muted); padding: 6px 0; }
.comeback { margin: 2px 0 10px; }
/* «Как сказать?» is the longest caption: two short lines; the second one hangs below so its icon stays in line with the others. */
.tool[data-act="howto"] .cap { white-space: normal; overflow: visible; text-align: center; margin-bottom: -1.1em; }

/* ---------- 8.11 (owner) ---------- */
/* One screen from any link: the neighbour in the scene, the headline, one button. */
.talk.gated .over, .talk.gated .who-pill, .talk.gated .state { display: none; }
.gate { position: absolute; left: 14px; right: 14px; bottom: calc(22px + env(safe-area-inset-bottom) + var(--tg-bottom, 0px)); z-index: 6; display: flex; flex-direction: column; gap: 10px; align-items: stretch;
  background: rgba(255, 252, 246, .94); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-radius: 20px; padding: 14px 14px 12px; box-shadow: 0 8px 28px rgba(43, 35, 64, .18); }
.gate-news { display: flex; gap: 8px; font-size: 16px; line-height: 1.3; }
.gate-who { font-size: 15px; color: #4A4060; text-align: center; }
.gate-go { font-size: 19px; min-height: 56px; }
.gate-ai { margin: 0; font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.3; }
/* «Сохранить прогресс» and the city. */
.save-box h2 { margin: 0 0 6px; }
.save-box .city-box { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.city-box { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.city-box .stack, .city-box .city-pick { width: 100%; }
.city-big { display: flex; flex-wrap: wrap; gap: 6px; }
.city-big .chip-btn { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 14.5px; font-weight: 600; }
.city-hint { color: #8A4B10; margin: 0; }
.city-offer { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: #FFF4D6; border-radius: 12px; padding: 8px 10px; }
.city-box .row { display: flex; gap: 8px; flex-wrap: wrap; }
/* Settings: only «Удалить аккаунт» is red. */
.calm-del { display: flex; flex-direction: column; gap: 3px; padding: 10px 0; border-top: 1px solid var(--line); }
.calm-del .btn { align-self: flex-start; }
.size-seg button { font-weight: 700; }
/* «Как сказать?» compact (owner, 8.11). */
.howto.compact h2 { margin: 0 0 2px; font-size: 20px; }
.howto-lead { margin: 0 0 10px; color: var(--muted); font-size: 15px; }
.howto-row { display: flex; gap: 8px; align-items: center; }
.howto-row input { flex: 1 1 auto; min-width: 0; font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; }
.howto-mic, .howto-send { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; font-size: 20px; display: grid; place-items: center; }
.howto-mic { background: var(--terra); color: #fff; }
.howto-mic.on { background: #2F8A63; animation: howto-pulse 1.4s ease-in-out infinite; }
@keyframes howto-pulse { 50% { box-shadow: 0 0 0 7px rgba(47, 138, 99, .25); } }
.howto-send { background: var(--bg2); color: var(--ink); font-weight: 800; }
.howto-out { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 24px; }
.howto-note { margin: 0; font-size: 14.5px; color: #5A5068; }
.howto-opt { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 9px 11px; }
.howto-opt.main { border-color: var(--terra); }
.howto-opt .es { font-size: 19px; font-weight: 700; }
.howto-opt .ru { color: #5A5068; font-size: 14.5px; }
.howto-opt .row { display: flex; gap: 8px; margin-top: 8px; }
.howto-ex { font-size: 15px; padding: 0 4px; } .howto-ex .ru { color: var(--muted); }
.howto-ideas { margin: 10px 0 0; }
.tool.glow .ic { border-color: var(--saffron); box-shadow: 0 0 0 4px rgba(232, 163, 61, .35); animation: tool-glow 1.6s ease-in-out infinite; }
@keyframes tool-glow { 50% { box-shadow: 0 0 0 7px rgba(232, 163, 61, .2); } }
/* «Уйти» in the corner (owner, 8.11): out of the bar, still one tap. */
.leave-corner { position: absolute; top: calc(10px + env(safe-area-inset-top) + var(--tg-top, 0px)); right: 10px; z-index: 5; display: flex; align-items: center; gap: 5px;
  background: rgba(255, 252, 246, .88); border: 1px solid rgba(43, 35, 64, .12); border-radius: 999px; padding: 6px 12px 6px 9px; font-size: 14px; font-weight: 700; color: #4A4060; }
.leave-corner svg { width: 17px; height: 17px; display: block; }
.leave-corner:disabled { opacity: .45; }
.talk.gated .leave-corner { display: none; }
.scene-col:has(.leave-corner) .news-card { top: calc(54px + env(safe-area-inset-top) + var(--tg-top, 0px)); }
.notice-box.paused-note { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; } .notice-box.paused-note .row { margin-top: 0; }
