:root { --ink: #efe9df; --dim: rgba(239, 233, 223, 0.55); --line: rgba(239, 233, 223, 0.2); --accent: #d97757; --mono: 'JetBrains Mono', ui-monospace, monospace; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: #000; color: var(--ink); font-family: var(--mono); overflow: hidden; }
#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; cursor: grab; touch-action: none; }
#gl:active { cursor: grabbing; }
body.idle #gl { cursor: none; }
#shade { position: fixed; left: 0; right: 0; bottom: 0; height: 34vh; pointer-events: none; background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.45) 45%, transparent); }

#caption { position: fixed; left: 50%; bottom: calc(64px + 5vh); transform: translateX(-50%); width: min(64ch, calc(100vw - 32px)); margin: 0; text-align: center; font-size: clamp(15px, 1.3vw, 21px); line-height: 1.6; letter-spacing: 0.07em; text-transform: lowercase; pointer-events: none; text-shadow: 0 0 18px #000, 0 0 4px #000; }
#def { position: fixed; left: 50%; top: var(--def-top, 53%); transform: translateX(-50%); width: min(64ch, calc(100vw - 32px)); margin: 0; text-align: center; font-size: calc(var(--cell, 17px) * 0.7); line-height: 1.6; color: #a9a39a; letter-spacing: 0.04em; font-style: italic; font-weight: 300; opacity: 0; pointer-events: none; text-shadow: 0 0 18px #000, 0 0 4px #000; }
#caption a.ref { pointer-events: auto; color: var(--accent); text-decoration: none; font-size: 0.65em; vertical-align: super; margin-left: 0.4em; }

.hud { position: fixed; z-index: 5; transition: opacity 0.6s; }
body.idle .hud { opacity: 0; pointer-events: none; }
.top { top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; font-size: 12px; letter-spacing: 0.12em; color: var(--dim); }
.top a { color: var(--dim); text-decoration: none; }
.top a:hover { color: var(--ink); }
.sep { margin: 0 0.7em; opacity: 0.5; }
#room { color: var(--accent); margin-left: 0.9em; }
button { font: inherit; color: var(--dim); background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 3px; padding: 4px 9px; cursor: pointer; letter-spacing: 0.08em; }
button:hover { border-color: rgba(239, 233, 223, 0.5); color: var(--ink); }
button.off { opacity: 0.45; text-decoration: line-through; }
#sndBtn { display: inline-flex; align-items: center; padding: 5px 8px; }
#sndBtn.off { text-decoration: none; }
#sndBtn .off-i, #sndBtn.off .on-i { display: none; }
#sndBtn.off .off-i { display: block; }
.bar { left: 0; right: 0; bottom: 0; display: flex; gap: 8px; align-items: center; padding: 10px 16px 14px; font-size: 12px; color: var(--dim); }
#track { position: relative; flex: 1; height: 22px; cursor: pointer; }
#track::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line); }
#fill { position: absolute; left: 0; top: 50%; height: 1px; background: var(--accent); }
.tick { position: absolute; top: calc(50% - 4px); width: 1px; height: 9px; background: rgba(239, 233, 223, 0.35); }
#tip { position: absolute; bottom: 22px; transform: translateX(-50%); white-space: nowrap; color: var(--ink); font-size: 11px; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
#track:hover #tip { opacity: 1; }
#clock { min-width: 11ch; text-align: right; font-variant-numeric: tabular-nums; }

#ecos { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
/* Eco card: frosted glass over a slow color flow (flow.js). The left bar is
   the voice color with a rainbow on top: strong while typing, faint after. */
.eco { position: absolute; max-width: min(34ch, 40vw); font-size: 12.5px; line-height: 1.6; letter-spacing: 0.04em; color: rgba(239, 233, 223, 0.8); cursor: pointer; text-transform: lowercase; padding: 12px 14px; border-radius: 6px; overflow: hidden; background: rgba(8, 8, 12, 0.3); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: color 0.2s ease, background-color 0.3s ease; animation: eco-in 600ms cubic-bezier(0.23, 1, 0.32, 1) both, eco-drift 9s ease-in-out 600ms infinite alternate; }
.eco canvas.flow { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.4; mix-blend-mode: screen; filter: blur(6px); pointer-events: none; }
.eco > :not(canvas), .eco .reply { position: relative; }
.eco::before, .eco::after, .eco .reply::before, .eco .reply::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; z-index: 1; }
.eco::before, .eco .reply::before { background: var(--vc); }
.eco::after, .eco .reply::after { background: linear-gradient(180deg, #ff3df2, #f6ff3a, #3cffb0, #3cf2ff, #8a7dff, #ff3df2); background-size: 100% 300%; animation: eco-bar 2.4s linear infinite; opacity: 0.18; transition: opacity 700ms ease-out; }
.eco.typing::after, .eco .reply.typing::after { opacity: 1; transition-duration: 120ms; }
@keyframes eco-in { from { opacity: 0; filter: blur(10px); transform: translateY(8px); } }
@keyframes eco-drift { to { transform: translate(3px, -5px); } }
@keyframes eco-bar { to { background-position: 0 300%; } }
.eco:hover { color: var(--ink); }
.eco p { margin: 0; }
.eco .v { color: var(--vc); font-size: 10.5px; letter-spacing: 0.18em; margin-bottom: 4px; }
.eco .more { margin-top: 6px; font-size: 10.5px; color: var(--dim); letter-spacing: 0.12em; }
.eco .replies { display: none; }
.eco.open { max-width: min(46ch, calc(100vw - 32px)); color: var(--ink); background-color: rgba(8, 8, 12, 0.55); z-index: 2; }
.eco.open .replies { display: block; }
.eco.open .more { display: none; }
.eco .reply { margin-top: 14px; padding: 6px 0 6px 12px; transition: opacity 0.2s ease-out; }
@media (prefers-reduced-motion: reduce) { .eco, .eco::after, .eco .reply::after { animation: none; } }
.slot-tl { top: 11vh; left: 4vw; }
.slot-tr { top: 15vh; right: 4vw; }
.slot-mr { top: 38vh; right: 5vw; }
.slot-ml { top: 42vh; left: 5vw; }

.start { position: fixed; inset: 0; z-index: 6; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding: 0 16px 20vh; pointer-events: none; font-size: 13px; letter-spacing: 0.12em; color: var(--ink); text-align: center; }
/* The card darkens toward its center and fades at the edges. Two rainbow arcs
   turn around its border (--a), with a soft glow that cycles the same colors. */
@property --a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.start .card { position: relative; pointer-events: auto; max-width: 560px; padding: 22px 28px 18px; border-radius: 18px; background: radial-gradient(ellipse at center, rgba(6, 6, 10, 0.78), rgba(6, 6, 10, 0.42)); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); text-shadow: 0 0 10px #000; animation: start-glow 12s linear infinite; }
.start .card::before { content: ''; position: absolute; inset: 0; padding: 1.5px; border-radius: inherit; pointer-events: none; background: conic-gradient(from var(--a), transparent 0 6%, #ff3df2 16%, #f6ff3a 26%, transparent 38% 50%, #3cffb0 60%, #3cf2ff 70%, #8a7dff 80%, transparent 92%); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0.9; animation: start-turn 10s linear infinite; }
@keyframes start-turn { to { --a: 360deg; } }
@keyframes start-glow {
  0%, 100% { box-shadow: 0 0 40px rgba(255, 61, 242, 0.32); }
  20% { box-shadow: 0 0 40px rgba(246, 255, 58, 0.28); }
  40% { box-shadow: 0 0 40px rgba(60, 255, 176, 0.3); }
  60% { box-shadow: 0 0 40px rgba(60, 242, 255, 0.32); }
  80% { box-shadow: 0 0 40px rgba(138, 125, 255, 0.34); }
}
@media (prefers-reduced-motion: reduce) { .start .card, .start .card::before { animation: none; } .start .card { box-shadow: 0 0 40px rgba(138, 125, 255, 0.32); } }
.start p { margin: 8px 0; line-height: 1.6; }
.start .sub { font-size: 11px; color: var(--dim); }
.start .snd { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; color: var(--accent); letter-spacing: 0.2em; text-transform: uppercase; font-size: 12px; }
#go { display: block; margin: 0 auto 14px; padding: 9px 30px; font-size: 14px; letter-spacing: 0.24em; color: var(--ink); background: rgba(0, 0, 0, 0.5); border-color: rgba(239, 233, 223, 0.6); transition: background-color 0.2s ease, transform 0.12s ease; }
#go:hover { background: rgba(239, 233, 223, 0.12); }
#go:active { transform: scale(0.97); }
#fsBtn { display: inline-flex; align-items: center; padding: 5px 8px; }
kbd { font-family: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 3px; padding: 1px 6px; }
.help { position: fixed; inset: 0; z-index: 8; display: grid; place-items: center; background: rgba(0, 0, 0, 0.7); padding: 16px; }
.help > div { max-width: 520px; font-size: 13px; line-height: 1.7; border: 1px solid var(--line); background: #000; padding: 24px; }
.help h2 { margin: 0 0 12px; font-weight: 400; font-size: 14px; letter-spacing: 0.2em; color: var(--accent); }
.help dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px; margin: 18px 0 0; }
.help dt { color: var(--ink); } .help dd { margin: 0; color: var(--dim); }
.end { position: fixed; left: 0; right: 0; bottom: 26vh; z-index: 6; text-align: center; font-size: 13px; letter-spacing: 0.12em; color: var(--dim); }
.end a { color: var(--ink); margin: 0 0.8em; }
.end .soon { opacity: 0.5; }
.toast { position: fixed; top: 52px; left: 50%; transform: translateX(-50%); z-index: 9; font-size: 12px; letter-spacing: 0.12em; color: var(--ink); opacity: 0; transition: opacity 0.3s; pointer-events: none; }
.toast.show { opacity: 1; }
.toast.long { max-width: calc(100vw - 32px); text-align: center; line-height: 1.6; text-shadow: 0 0 12px #000, 0 0 4px #000; }

body.fondo .hud, body.fondo #caption, body.fondo #def, body.fondo #ecos, body.fondo #shade, body.fondo .start, body.fondo .end { display: none !important; }
#gl, #fill, #room { transition: background-color 0.4s ease, color 0.4s ease; }

@media (max-width: 700px) {
  .eco { max-width: 72vw; font-size: 11.5px; }
  .slot-tr, .slot-mr { right: 16px; } .slot-tl, .slot-ml { left: 16px; }
  .slot-mr, .slot-ml { top: auto; bottom: calc(150px + 14vh); }
  #clock, #spd { display: none; }
}
