:root {
  --bg: #14101a;
  --panel: #221b2b;
  --line: #3a3046;
  --text: #f6f1fa;
  --muted: #b5a9c2;
  --accent: #ff3d71;
  --female: #ff3d71;
  --male: #3d9bff;
  --danger: #ff6b5e;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1 { font-size: 2.2rem; margin: 0 0 .25rem; color: var(--accent); }
h2 { font-size: 1.2rem; margin: 0 0 .75rem; }
button, input, select { font: inherit; }
button { min-height: 44px; padding: .5rem 1rem; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.danger { color: var(--danger); border-color: var(--danger); }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
a { color: inherit; }
.lead { color: var(--muted); margin: 0 0 1rem; }
.note { color: var(--muted); font-size: .875rem; margin: 0 0 .75rem; }
.error { color: var(--danger); margin: .5rem 0; }

.screen { max-width: 420px; margin: 0 auto; padding: 48px 16px; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
legend { padding: 0; margin-bottom: .5rem; }
.choice { display: flex; align-items: center; gap: .6rem; min-height: 44px; padding: 0 .75rem; border: 1px solid var(--line); border-radius: 10px; margin-bottom: .5rem; }
.date-row { display: grid; grid-template-columns: 1fr 1.6fr 1.2fr; gap: 8px; }
.date-row select { width: 100%; min-width: 0; min-height: 48px; padding: 0 28px 0 .75rem; border-radius: 10px; border: 1px solid var(--line); color: var(--text); cursor: pointer; appearance: none; -webkit-appearance: none; background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23b5a9c2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 10px center; }
.date-row select:invalid { color: var(--muted); }
.date-row option { color: var(--text); background: var(--panel); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
.check { display: flex; align-items: center; gap: .6rem; min-height: 44px; margin-bottom: 1rem; }
#gate-form > button.primary { width: 100%; }

#app, #map { position: fixed; inset: 0; }
.topbar { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 16px; display: flex; gap: 8px; }
.round { position: relative; width: 48px; height: 48px; min-height: 48px; padding: 0; border-radius: 50%; background: var(--panel); font-size: 1.25rem; }
.badge { position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--accent); color: #fff; font-size: .75rem; line-height: 20px; }
.dock { position: absolute; left: 16px; right: 16px; bottom: calc(24px + env(safe-area-inset-bottom)); max-width: 480px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.dock p { margin: 0; }

.switch { position: relative; flex: none; width: 60px; height: 34px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.slider { position: absolute; inset: 0; border-radius: 17px; background: var(--line); pointer-events: none; transition: background .15s; }
.slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::after { transform: translateX(26px); }
.switch input:focus-visible + .slider { outline: 2px solid #fff; outline-offset: 2px; }

.pin { width: 26px; height: 26px; padding: 0; min-height: 0; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,.5); }
.pin.female { background: var(--female); }
.pin.male { background: var(--male); }
.cluster { width: 44px; height: 44px; padding: 0; min-height: 0; border-radius: 50%; border: 3px solid #fff; background: var(--accent); color: #fff; font-weight: 700; box-shadow: 0 1px 6px rgba(0,0,0,.5); }
.pin.mine { outline: 3px solid #ffd60a; outline-offset: 2px; }

dialog { width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; padding: 20px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog ul { padding-left: 1.2rem; margin: 0 0 1rem; }
dialog li { margin-bottom: .4rem; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.actions.stack { flex-direction: column; }
.list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 1rem; }
.list .empty { color: var(--muted); margin: 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.list > button { text-align: left; }

dialog.tall { height: calc(var(--visible-height, 100dvh) - 32px); }
dialog.tall[open] { display: flex; flex-direction: column; }
.messages { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 8px 0; }
.msg { max-width: 80%; padding: .4rem .7rem; border-radius: 12px; background: var(--line); align-self: flex-start; overflow-wrap: anywhere; }
.msg.mine { background: var(--accent); color: #fff; align-self: flex-end; }
.composer { display: flex; gap: 8px; }
.composer input { flex: 1; min-width: 0; min-height: 44px; padding: 0 .75rem; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }

@media (prefers-reduced-motion: reduce) { .slider, .slider::after { transition: none; } }
.chat-dot { display: inline-block; flex: none; width: 14px; height: 14px; margin-right: 8px; border-radius: 50%; vertical-align: -1px; }
.chat-row { display: flex; align-items: center; width: 100%; text-align: left; }
.chat-head { display: flex; align-items: center; gap: 8px; }
.chat-head h2 { flex: 1; min-width: 0; margin: 0; }
.chat-hint { margin: 0 0 4px; color: var(--muted); font-size: .8rem; }
