/* The gate (gate.html) and 404.html: the game's start screen for everyone who isn't let in yet. The ticket
   and the sea come from /css/ticket.css (the same file the start screen uses); this is only what's the
   gate's own: the page, the stub's panels and buttons, the stamp changing with the state. */
:root {
  color-scheme: light;
  --navy: #1d3557;
  --navy-2: #2a4a72;
  --paper: #f2e7cc;
  --ink: #1f2233;
  --brown: #5a5040;
  --brown-2: #6b6052;
  --red: #c62828;
  --green: #16a34a;
  --mono: "Courier Prime", ui-monospace, monospace;
  --type: "Special Elite", ui-monospace, monospace;
  --slab: "Alfa Slab One", Georgia, serif;
  --spring: cubic-bezier(.2, 1.2, .4, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: #22313f; }
body {
  margin: 0; min-height: 100dvh; overflow-x: hidden; background: #22313f;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
.start-sea { position: fixed; }

/* ---------- the page: the ticket in the middle ---------- */
.gate {
  position: relative; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: max(24px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
}

.tk { grid-template-columns: minmax(0, 1fr) 300px; width: min(840px, 100%); animation: tk-in .9s var(--spring) both; }
@keyframes tk-in { from { opacity: 0; transform: translateY(30px) rotate(3deg) scale(.96); } }
.tk-main { min-height: 330px; padding-bottom: 66px; }
.tk-stub { gap: 0; padding: 26px 24px 24px 34px; }
/* the members' line, printed small under the title like the ticket's conditions */
.tk-tag { margin: 12px 0 0; max-width: 23em; font: 400 14px/1.45 var(--type); color: var(--brown); }

/* the stamp: pressed down again whenever the ticket's state changes */
.tk-stamp.blue { color: var(--navy); }
.tk-stamp.green { color: var(--green); }
.tk-stamp.down { animation: stamp .42s cubic-bezier(.3, 1.6, .5, 1) .1s both; }
@keyframes stamp { from { opacity: 0; transform: rotate(-14deg) scale(1.7); } 60% { opacity: .9; } to { opacity: .86; transform: rotate(-14deg) scale(1); } }
.tk-stamp:empty, .tk[data-state="loading"] .tk-stamp { display: none; }

/* ---------- the stub: who you are, and what happens next ---------- */
/* the conductor's punch inside the torn edge: the holes go round while the office is being asked */
.punch { position: absolute; left: 7px; top: 22px; bottom: 22px; display: flex; flex-direction: column; justify-content: space-between; }
.punch i { width: 7px; height: 7px; border-radius: 50%; background: rgba(140, 112, 64, .22); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .14); transition: background .3s; }
.tk.busy .punch i { animation: punch 1.5s ease-in-out infinite; }
.tk.busy .punch i:nth-child(2) { animation-delay: .1s; } .tk.busy .punch i:nth-child(3) { animation-delay: .2s; }
.tk.busy .punch i:nth-child(4) { animation-delay: .3s; } .tk.busy .punch i:nth-child(5) { animation-delay: .4s; }
.tk.busy .punch i:nth-child(6) { animation-delay: .5s; } .tk.busy .punch i:nth-child(7) { animation-delay: .6s; }
.tk.busy .punch i:nth-child(8) { animation-delay: .7s; } .tk.busy .punch i:nth-child(9) { animation-delay: .8s; }
.tk.busy .punch i:nth-child(10) { animation-delay: .9s; }
@keyframes punch { 0%, 100% { background: rgba(140, 112, 64, .22); } 30% { background: #22313f; box-shadow: inset 0 1px 1.5px rgba(0, 0, 0, .6); } 60% { background: rgba(140, 112, 64, .22); } }
.tk[data-state="boarding"] .punch i { background: #22313f; box-shadow: inset 0 1px 1.5px rgba(0, 0, 0, .6), 0 .5px 0 rgba(255, 252, 240, .6); }

.tk-name { margin: -2px 0 0; min-height: 30px; font-size: 30px; }

.panels { flex: 1; display: flex; flex-direction: column; margin-top: 10px; }
.panel { display: flex; flex-direction: column; align-items: stretch; gap: 9px; flex: 1; }
.panel.in { animation: panel-in .45s var(--spring) both; }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } }

.lead { margin: 2px 0 0; font: 400 22px/1.05 var(--slab); color: var(--navy); text-shadow: 0 0 .8px rgba(29, 53, 87, .45); }
.line { margin: 0 0 4px; font: 400 13.5px/1.45 var(--type); color: #4d4740; }
.note { margin: 0; font: 400 12px/1.35 var(--type); color: var(--brown-2); }
.note.err { color: #9e1b1b; }
.fine { margin: auto 0 0; padding-top: 4px; font: 400 11px/1.4 var(--mono); color: var(--brown-2); }
.fine a, .foot a { color: inherit; text-underline-offset: 3px; }

.gsi { min-height: 44px; display: flex; justify-content: center; }
.gsi iframe { margin: 0 auto !important; }

.btn {
  display: block; width: 100%; padding: 12px 10px; border: 2px solid var(--navy); border-radius: 6px; background: transparent; color: var(--navy);
  font: 700 14px var(--mono); letter-spacing: .12em; text-transform: uppercase; text-align: center; text-decoration: none; cursor: pointer;
  transition: transform .08s, background .15s, color .15s, opacity .3s;
}
.btn.primary { background: var(--navy); color: var(--paper); }
.btn.danger { border-color: var(--red); background: var(--red); color: #fff; }
.btn:not(:disabled):hover { background: var(--navy-2); border-color: var(--navy-2); color: var(--paper); }
.btn.danger:not(:disabled):hover { background: #ad2020; border-color: #ad2020; }
.btn:not(:disabled):active { transform: translateY(2px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn:focus-visible, .quiet:focus-visible, .fine a:focus-visible, .foot a:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

.quiet {
  align-self: center; margin-top: auto; padding: 6px 4px; border: 0; background: none; cursor: pointer; color: #8a1c1c;
  font: 700 12px var(--mono); letter-spacing: .1em; text-transform: uppercase; text-decoration: underline; text-underline-offset: 4px;
}
.quiet:disabled { opacity: .45; cursor: default; }

.foot { margin: 0; font: 400 12.5px var(--mono); letter-spacing: .08em; color: #d9cfb8; }

/* "Check again" found nothing new: the line nods, quietly */
.nod { animation: nod .5s ease; }
@keyframes nod { 30% { transform: translateX(-3px); } 60% { transform: translateX(2px); } }

/* ---------- a phone: the stub under the ticket (css/ticket.css), the punch across its top ---------- */
@media (max-width: 640px) {
  .tk { grid-template-columns: minmax(0, 1fr); }      /* (this file's two columns above would win over ticket.css's) */
  .tk-main { min-height: 0; padding-bottom: 84px; }
  .tk-stub { padding: 30px 22px 22px; }
  .punch { left: 22px; right: 22px; top: 7px; bottom: auto; flex-direction: row; }
  .quiet { margin-top: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .tk, .panel.in, .tk-stamp.down, .nod, .tk.busy .punch i { animation: none; }
}

/* ---------- 404.html: one part, no stub ---------- */
.tk.solo { grid-template-columns: minmax(0, 1fr); width: min(560px, 100%); }
.tk.solo .tk-main { min-height: 0; padding-bottom: 30px; border-radius: 10px; -webkit-mask: none; mask: none; }
.tk.solo .tk-main::before { inset: 10px; }
.tk.solo .back { width: auto; display: inline-block; margin-top: 22px; padding: 12px 20px; }
.tk.solo .tk-stamp { bottom: 34px; }
