/*
 * Phone page layout (index.html): home, the room bar, the answer dock and the host's
 * panels. Arranges components from components.css; uses tokens only.
 */

#app {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--page-gutter) calc(24px + env(safe-area-inset-bottom));
}

/* --- Home ------------------------------------------------------------------------------ */

.home {
  padding-top: calc(var(--space-10) + env(safe-area-inset-top));
}

.hero {
  margin-bottom: var(--space-8);
  text-align: center;
}

.hero h1 {
  font-size: 3em;
}

.hero p {
  margin: var(--space-2) 0 0;
  color: var(--color-on-bg-soft);
}

.hero b {
  color: var(--color-highlight);
}

.home-links {
  display: flex;
  justify-content: center;
  gap: var(--space-8);
}

.home-links a {
  color: var(--color-highlight);
}

/* --- Room bar -------------------------------------------------------------------------- */

.bar {
  position: sticky;
  top: 0;
  z-index: var(--z-bar);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: calc(var(--space-4) + env(safe-area-inset-top)) 0 var(--space-4);
  background: linear-gradient(var(--color-bg) 70%, transparent);
}

.brand {
  padding: var(--space-2) 0;
  border: 0;
  background: none;
  color: var(--color-on-bg);
  font-family: var(--font-display);
  font-weight: var(--weight-heavy);
  font-size: 1.05em;
  white-space: nowrap;
  cursor: pointer;
}

.room-chip,
.me-chip {
  overflow: hidden;
  padding: var(--space-1) var(--space-4);
  border: var(--border-sm) solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-quiet);
  color: var(--color-ink);
  font-size: 0.85em;
  white-space: nowrap;
  text-overflow: ellipsis;
  box-shadow: var(--shadow-sm);
}

/* The room code must always show in full (players read it out); the name chip gives way. */
.room-chip {
  flex: none;
}

.me-chip {
  min-width: 0;
  max-width: 45%;
  margin-inline-start: auto;
}

.me-chip:empty {
  display: none;
}

.host-tag {
  color: var(--color-mine);
  font-weight: var(--weight-heavy);
}

/* Connection status: grey while connecting, teal online, blinking red offline. */
.dot {
  flex: none;
  width: var(--status-dot);
  height: var(--status-dot);
  border: var(--border-sm) solid var(--color-line);
  border-radius: 50%;
  background: var(--color-on-bg-soft);
}

.dot.online {
  background: var(--color-success);
}

.dot.offline {
  background: var(--color-danger);
  animation: blink 1s infinite;
}

/* --- Answer dock ----------------------------------------------------------------------- */

#dock {
  margin-top: var(--space-6);
}

.answer-form {
  display: flex;
  gap: var(--space-3);
}

.answer-form input {
  flex: 1;
  font-size: var(--font-size-answer);
}

.answer-form .btn {
  min-width: 84px;
}

.answer-sent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  border: var(--border) solid var(--color-line);
  border-radius: var(--radius-lg);
  background: var(--color-success);
  color: var(--color-ink);
  font-weight: var(--weight-bold);
  box-shadow: var(--shadow);
}

.answer-sent b {
  font-size: 1.2em;
  font-weight: var(--weight-heavy);
}

.custom-form .row {
  margin-top: var(--space-1);
}

/* --- Lobby ----------------------------------------------------------------------------- */

.welcome .hello {
  margin: 0;
  font-size: 1.5em;
  font-weight: var(--weight-heavy);
}

.share {
  display: flex;
  align-items: center;
  gap: var(--space-7);
}

.share .qr {
  flex: none;
  width: 130px;
}

.settings .label {
  margin: var(--space-5) 0 var(--space-2);
  font-weight: var(--weight-bold);
}

.settings .label:first-child {
  margin-top: 0;
}

/* --- Host controls --------------------------------------------------------------------- */

.host-actions {
  display: grid;
  gap: var(--space-4);
  margin: var(--space-8) 0;
}

.host-actions.sticky {
  position: sticky;
  bottom: 0;
  padding: var(--space-5) 0 calc(var(--space-3) + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--color-band) 35%);
}

/* --- Stage: where each sticker sits behind the phone page ------------------------------ */

.stage .slot-1 {
  top: 27vh;
  left: var(--sticker-bleed);
  --size: var(--sticker-lg);
  --turn: 12deg;
}

.stage .slot-2 {
  top: 40vh;
  right: var(--sticker-bleed);
  --size: var(--sticker-sm);
  --turn: -10deg;
}

.stage .slot-3 {
  top: 9vh;
  right: var(--space-8);
  --size: var(--sticker-xs);
}

.stage .slot-4 {
  bottom: 3vh;
  left: var(--space-7);
  --size: var(--sticker-xl);
  --turn: -8deg;
}

.stage .slot-5 {
  bottom: 9vh;
  right: var(--space-10);
  --size: var(--sticker-xs);
}

.stage .slot-6 {
  top: 60vh;
  left: var(--sticker-bleed);
  --size: var(--sticker-md);
}
