:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0d1012;
  color: #eef1ef;
  font-synthesis: none;
  --surface: #15191c;
  --line: #2b3337;
  --line-strong: #465259;
  --muted: #9ca6a9;
  --accent: #76ddba;
  --accent-deep: #36af86;
  --danger: #ffbf69;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body { margin: 0; background: #0d1012; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }

.topbar { height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(22px, calc((100vw - 1120px) / 2)); border-bottom: 1px solid #22292c; background: rgba(13, 16, 18, .92); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; font-weight: 720; text-decoration: none; letter-spacing: -.01em; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; color: #07110d; background: var(--accent); font-size: .9rem; }
.identity { display: flex; align-items: center; gap: 13px; color: #c3ccca; font: 600 .78rem ui-monospace, SFMono-Regular, Menlo, monospace; }
.identity-item { display: flex; align-items: center; gap: 6px; }
.identity code { color: #e2e9e6; font: inherit; }
.identity-label { color: var(--muted); font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-weight: 600; }
.presence { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(118, 221, 186, .11); }
.connection-alert { color: #ffd28a; font: 750 .72rem Inter, ui-sans-serif, system-ui, sans-serif; letter-spacing: .01em; white-space: nowrap; }
.connection-lost .presence { background: #ffad42; box-shadow: 0 0 0 3px rgba(255, 173, 66, .16); }
.connection-lost .topbar, .connection-lost .game-toolbar { border-color: #a86725; box-shadow: inset 0 -2px 0 rgba(255, 173, 66, .22); }

.entry-view { width: min(100% - 36px, 600px); margin: 0 auto; padding: clamp(64px, 11vh, 110px) 0 40px; }
.entry-card { padding: 29px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 24px 70px rgba(0, 0, 0, .22); }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: .75rem; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 9px; font-size: clamp(1.75rem, 4vw, 2.3rem); line-height: 1.08; letter-spacing: -.035em; }
h2 { margin-bottom: 6px; font-size: 1rem; }
.intro, .aside-copy { color: var(--muted); }
.intro { max-width: 470px; margin-bottom: 25px; line-height: 1.55; }

button { min-height: 39px; padding: 0 15px; border: 1px solid var(--accent); border-radius: 7px; color: #07110d; background: var(--accent-deep); font-weight: 720; }
button:hover { filter: brightness(1.08); }
button.secondary { color: #e4e9e7; border-color: var(--line-strong); background: transparent; }
button.quiet { color: var(--muted); border-color: transparent; background: transparent; }
.entry-actions, .form-actions { display: flex; gap: 9px; }

.join-form { margin-top: 23px; padding-top: 21px; border-top: 1px solid var(--line); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: grid; gap: 7px; color: #bdc5c6; font-size: .82rem; font-weight: 650; }
input { width: 100%; min-width: 0; height: 42px; padding: 0 11px; color: #f1f4f2; border: 1px solid #3b464b; border-radius: 7px; outline: 0; background: #0e1214; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(118, 221, 186, .09); }
.masked-input { -webkit-text-security: disc; }
.form-actions { margin-top: 13px; }
.status, .room-status { min-height: 20px; margin: 14px 0 0; color: var(--danger); font-size: .84rem; line-height: 1.4; }
.status:empty, .room-status:empty { display: none; }
.recovery-actions { display: flex; gap: 9px; margin-top: 13px; }
.session-actions { margin-top: 8px; }
.session-actions:has(.logout[hidden]) { display: none; }

.room-view { width: min(100% - 36px, 1120px); margin: 0 auto; padding: 34px 0; }
.catalog-view { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.section-heading { margin-bottom: 18px; }
.section-heading h1 { font-size: 1.75rem; }
.applications { display: grid; gap: 8px; }
.application-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title action" "description action"; align-items: center; column-gap: 18px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.application-card h3 { grid-area: title; margin: 0 0 3px; font-size: .98rem; }
.application-card p { grid-area: description; margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.4; }
.application-card button { grid-area: action; }

.room-card { padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.aside-copy { margin-bottom: 12px; font-size: .82rem; line-height: 1.45; }
.copy-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.copy-field input { height: 38px; border-radius: 7px 0 0 7px; color: #b9c3c1; font: .75rem ui-monospace, SFMono-Regular, Menlo, monospace; }
.copy-field button { min-height: 38px; border-radius: 0 7px 7px 0; }
.divider { display: flex; align-items: center; gap: 9px; margin: 18px 0 10px; color: #778184; font-size: .69rem; text-transform: uppercase; letter-spacing: .08em; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.details { margin: 0; }
.details > div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid #252c2f; }
.details dt { color: var(--muted); font-size: .78rem; }
.details dd { margin: 0; text-align: right; }
.details code { color: #e2e9e6; font: 600 .77rem ui-monospace, SFMono-Regular, Menlo, monospace; }
.value-actions, .secret-value { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.reveal-password { min-height: 0; padding: 0; color: var(--accent); border: 0; background: transparent; font-size: .72rem; font-weight: 700; }
.copy-inline { min-height: 23px; padding: 0 7px; color: #cbd3d1; border-color: #3b4549; border-radius: 5px; background: transparent; font-size: .66rem; font-weight: 700; }
.full { width: 100%; margin-top: 14px; }

.application-view { position: fixed; inset: 0; z-index: 10; overflow: hidden; background: #080a0b; }
.game-stage { display: grid; grid-template-rows: 43px minmax(0, 1fr); width: 100%; height: 100%; }
.game-toolbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 0 9px; border-bottom: 1px solid #252b2e; background: #111517; }
.game-toolbar #application-name { color: #b8c0c1; font-size: .78rem; font-weight: 650; }
.game-context { display: flex; align-items: center; gap: 15px; min-width: 0; }
.game-identity { display: flex; align-items: center; gap: 6px; color: #7f8a8c; font-size: .68rem; white-space: nowrap; }
.game-identity code { color: #dce3e1; font: 600 .7rem ui-monospace, SFMono-Regular, Menlo, monospace; }
.toolbar-button { justify-self: start; min-height: 29px; padding: 0 10px; color: #cfd5d3; border-color: #394246; background: transparent; font-size: .76rem; }
.room-button { justify-self: end; }
#application-frame { display: block; width: 100%; height: 100%; border: 0; background: #000; }

.application-sidebar { position: absolute; z-index: 13; top: 0; right: 0; width: min(340px, calc(100vw - 38px)); height: 100%; padding: 18px; border-left: 1px solid var(--line); background: #15191cf7; box-shadow: -24px 0 60px rgba(0, 0, 0, .32); transform: translateX(101%); transition: transform 150ms ease; }
.application-sidebar.open { transform: translateX(0); }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.sidebar-heading h2 { margin: 0; font-size: 1.05rem; }
.icon-button { min-width: 32px; min-height: 32px; padding: 0; color: #cbd2d1; border-color: var(--line); background: transparent; font-size: 1.3rem; font-weight: 400; }
.details.compact { margin-top: 17px; }
.sidebar-scrim { position: absolute; z-index: 12; inset: 0; display: none; min-height: 0; padding: 0; border: 0; border-radius: 0; background: rgba(0, 0, 0, .42); }
.application-sidebar.open + .sidebar-scrim { display: block; }

@media (max-width: 760px) {
  .topbar { padding: 0 18px; }
  .entry-view, .room-view { width: min(100% - 24px, 680px); }
  .entry-card { padding: 25px 20px; }
  .field-row { grid-template-columns: 1fr; }
  .catalog-view { grid-template-columns: 1fr; }
  .room-card { order: -1; }
  .game-context #application-name { display: none; }
  .game-context { gap: 9px; }
  .game-identity > span { display: none; }
}

@media (max-width: 440px) {
  .entry-actions { display: grid; }
  .application-card { grid-template-columns: 1fr; grid-template-areas: "title" "description" "action"; row-gap: 8px; }
  .application-card button { justify-self: start; }
}
