/* The public pages' shared styles (agents/briefs/029, 076): index.html and privacy.html.
   The menus' palette (agents/briefs/018, 029), the same tokens as client/index.html's :root, trimmed to what these
   pages use. Separate documents, so the tokens are duplicated rather than shared: they bundle none of the game's
   code. */
:root {
  --ui-panel: #efdbbf;
  --ui-panel-rim: #fbeed8;
  --ui-panel-edge: #c59a5a;
  --ui-rule: rgba(125, 94, 58, 0.3);
  --ui-header: #303142;
  --ui-header-text: #f6e6c4;
  --ui-text: #3b302b;
  --ui-muted: #7d6551;
  --ui-slot: #e9d6b8;
  --ui-slot-edge: #d2b893;
  --ui-accent: #e9b54e;
  --ui-wood: #755738;
  --ui-wood-text: #fbe9c8;
  --ui-danger: #a8412f;
  --ui-danger-bg: #f3cdb8;
  --ui-font: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --ui-title-font: Georgia, "Palatino Linotype", "Book Antiqua", serif;
  --page-bg: #1c1a24;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--page-bg);
  color: var(--ui-panel-rim);
  font-family: var(--ui-font);
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 48px;
}

main {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

header {
  width: 100%;
  max-width: 720px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.brand, .brand:visited {
  text-decoration: none;
}

.brand {
  display: block;
  margin: 0;
  line-height: 0;
}

/* The game's curved lettering, cut from its logo (agents/briefs/093); "Comet Island" as its alternative text. */
.brand-logo {
  display: block;
  width: clamp(190px, 42vw, 280px);
  height: auto;
}

.language-select {
  font: inherit;
  font-size: 13px;
  color: var(--ui-text);
  background: var(--ui-panel-rim);
  border: 2px solid var(--ui-slot-edge);
  border-radius: 8px;
  padding: 5px 8px;
  cursor: pointer;
}
.language-select:hover, .language-select:focus { border-color: var(--ui-accent); outline: none; }

.badge {
  display: inline-block;
  align-self: flex-start;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--ui-wood);
  color: var(--ui-wood-text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tagline, .description { margin: 0; }

.tagline {
  font-size: clamp(16px, 3.6vw, 20px);
  line-height: 1.4;
}

.description {
  font-size: clamp(13px, 3vw, 15px);
  line-height: 1.5;
  color: #cfc6da;
}

/* A panel: parchment with a gold edge, same look as the game's own cards (client/index.html's #auth-form). */
.panel {
  box-sizing: border-box;
  padding: clamp(16px, 4vw, 24px);
  background: var(--ui-panel);
  border: 2px solid var(--ui-panel-edge);
  border-radius: 16px;
  box-shadow: inset 0 0 0 2px var(--ui-panel-rim), 0 10px 30px rgba(40, 26, 12, 0.35);
  color: var(--ui-text);
}

.panel h2 {
  margin: calc(-1 * clamp(16px, 4vw, 24px)) calc(-1 * clamp(16px, 4vw, 24px)) 16px;
  padding: 12px clamp(16px, 4vw, 24px);
  background: var(--ui-header);
  border-bottom: 2px solid var(--ui-panel-edge);
  border-radius: 14px 14px 0 0;
  color: var(--ui-header-text);
  font-family: var(--ui-title-font);
  font-size: 19px;
  font-weight: 700;
}

#site-feedback-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

input, textarea, button {
  font: inherit;
  font-size: 14px;
}

input, textarea {
  padding: 8px 10px;
  color: var(--ui-text);
  background: var(--ui-panel-rim);
  border: 2px solid var(--ui-slot-edge);
  border-radius: 8px;
  outline: none;
  width: 100%;
  resize: vertical;
}
input:focus, textarea:focus { border-color: var(--ui-accent); }
input::placeholder, textarea::placeholder { color: var(--ui-muted); }

button {
  padding: 8px 14px;
  color: var(--ui-text);
  background: var(--ui-slot);
  border: 2px solid var(--ui-slot-edge);
  border-radius: 8px;
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--ui-panel-edge); }
button:disabled { opacity: 0.5; cursor: default; }
button[type="submit"]:not(.secondary), .primary {
  color: var(--ui-wood-text);
  background: var(--ui-wood);
  border-color: var(--ui-accent);
}

#site-feedback-footer { display: flex; gap: 8px; flex-wrap: wrap; }

/* The play panel (agents/briefs/076): two choice buttons, then one of two forms. */
.choice { display: flex; gap: 10px; flex-wrap: wrap; }
.choice-button {
  flex: 1;
  min-width: 180px;
  padding: 12px 14px;
  text-align: center;
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  color: var(--ui-text);
  background: var(--ui-slot);
  border: 2px solid var(--ui-slot-edge);
  border-radius: 8px;
}
.choice-button.primary { color: var(--ui-wood-text); background: var(--ui-wood); border-color: var(--ui-accent); }
.choice-button:hover { border-color: var(--ui-accent); }

.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form[hidden], .choice[hidden] { display: none; }
.auth-form .primary { padding: 10px 14px; font-size: 15px; }
.form-title { font-family: var(--ui-title-font); font-size: 17px !important; font-weight: 700; }
.form-hint { font-size: 12px !important; color: var(--ui-muted); }
.form-message { min-height: 1.2em; font-size: 13px; }
.form-message.bad { color: var(--ui-danger); font-weight: 700; }
.form-link {
  align-self: center;
  padding: 0;
  font-size: 13px;
  color: var(--ui-muted);
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
}
.form-link:hover { color: var(--ui-text); background: none; }

/* Off screen rather than display: none, which some bots skip (agents/briefs/029, like the game's own trap). */
#site-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

#site-feedback-status {
  min-height: 1.2em;
  font-size: 13px;
}
#site-feedback-status.bad, #site-confirmation-text.bad { color: var(--ui-danger); font-weight: 700; }

/* A session already open on this device (agents/briefs/076): the message, then a button back to the game. */
#site-already {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: var(--ui-panel-rim);
  border: 1px solid var(--ui-slot-edge);
  border-radius: 10px;
}
#site-already.shown { display: flex; }


#site-invite-banner {
  display: none;
  padding: 10px 14px;
  background: var(--ui-danger-bg);
  border: 2px solid var(--ui-danger);
  border-radius: 10px;
  color: var(--ui-danger);
  font-size: 13px;
  font-weight: 700;
}

.panel ul {
  margin: 0 0 14px;
  padding-left: 20px;
}
.panel ul li { margin: 6px 0; font-size: 13px; line-height: 1.4; }
.panel p { font-size: 13px; line-height: 1.5; margin: 0; }

footer {
  width: 100%;
  max-width: 720px;
  margin-top: 8px;
  text-align: center;
  font-size: 12px;
  color: var(--ui-muted);
}

/* Phone width: narrower side gutter already handled by body padding, but the panel's own padding shrinks too. */
@media (max-width: 420px) {
  header { flex-wrap: wrap; }
}

/* The residents' group picture (agents/briefs/076): an illustration, framed like a panel. */
.hero {
  margin: 0;
}
.hero img {
  display: block;
  width: 100%;
  height: auto;
  /* Cropped to a 16:9 band kept high, so the Observatory's telescope (central to the story) and the residents' feet
     both stay in view, and the registration form stays in the first screen on a computer. */
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: 50% 15%;
  border: 2px solid var(--ui-panel-edge);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(40, 26, 12, 0.35);
}

/* Short loops of the real game (agents/briefs/092), two by two, one by one on a phone. */
.gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.gallery figure { margin: 0; }
.gallery video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--ui-slot-edge);
  border-radius: 10px;
}
/* A visitor who asked for less motion (site.ts): the poster with a play button, a click plays the loop. */
.gallery figure.still { position: relative; }
.gallery figure.still video { cursor: pointer; }
.gallery figure.still::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  aspect-ratio: 16 / 9;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Ccircle cx='32' cy='32' r='32' fill='rgba(20,16,10,0.55)'/%3E%3Cpath d='M25 19v26l21-13z' fill='white'/%3E%3C/svg%3E") center / 64px no-repeat;
  pointer-events: none;
  z-index: 1;
}
.gallery figure.still.playing::before { display: none; }
.gallery figcaption {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.35;
}
@media (max-width: 520px) {
  .gallery { grid-template-columns: 1fr; }
}

footer a, .back-link { color: var(--ui-muted); }
footer a:hover, .back-link:hover { color: var(--ui-panel-rim); }
.back-link { align-self: flex-start; font-size: 13px; }

.brand-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand-line .badge { align-self: center; }

.panel h3 { margin: 16px 0 4px; font-family: var(--ui-title-font); font-size: 15px; }
.panel h2 + h3 { margin-top: 0; }
.panel p a { color: var(--ui-wood); }
