/* Shell chrome — ADR-APP-007 Phase C.
   Everything about how a *board* looks comes from ../ui/style.css;
   this file only adds what the shell has and the play pages don't: the pack
   cards, the puzzle grid, the settings rows. Same discipline: no fonts, no
   icons, nothing fetched from anywhere. */

/* --- screen switching ---------------------------------------------------- */

/* One screen at a time; the hash decides which. [hidden] alone loses to the
   flex display the play screen's <main> inherits, so make it absolute. */
section[hidden] { display: none !important; }

section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-height: 0;
}

/* --- shared screen furniture --------------------------------------------- */

.shell-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.2rem;
}

.shell-bar h1 {
  margin: 0;
  font-size: 1.15rem;
  flex: 1 1 auto;
}

.back {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.gear {
  color: var(--muted);
  text-decoration: none;
  font-size: 1.3rem;
  line-height: 1;
}

.shell-foot {
  margin: 0;
  text-align: center;
  font-size: 0.9rem;
}

.shell-foot a { color: var(--accent); }

.play-title {
  font-weight: 700;
  font-size: 0.9rem;
  /* `1 1 0` rather than `1 1 auto`: the title is the one thing in the bar that
     can be truncated, so it must give up space *before* a control wraps onto a
     second row. With four controls since ADR-APP-009 added Check, `auto` kept
     the title at its natural width and pushed Reset down on every phone. */
  flex: 1 1 0;
  min-width: 2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The shared `.progress` pushes itself right with `margin-left: auto`, which
   soaks up the slack the title would otherwise have surrendered. On the play
   bar the buttons already sit at the right-hand end, so it is not needed. */
#screen-play .progress { margin-left: 0; }

/* --- pack cards ---------------------------------------------------------- */

.pack-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.pack-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  padding: 0.8rem 0.9rem;
  color: var(--ink);
  text-decoration: none;
}

.pack-card h2 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
}

.pack-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.pack-card .meta {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* A pack the entitlements module says the player doesn't own. */
.pack-card.locked {
  opacity: 0.7;
  cursor: default;
}

.pack-card.locked .meta { color: var(--bad); }

/* --- the puzzle grid ----------------------------------------------------- */

.puzzle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
  gap: 0.5rem;
  align-content: start;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  padding: 0.55rem 0.4rem;
  text-align: center;
  color: var(--ink);
  text-decoration: none;
}

.tile .num {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tile .sub {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.tile .state {
  display: block;
  font-size: 0.78rem;
  margin-top: 0.2rem;
  min-height: 1.1em;
}

.tile.done { border-color: var(--good); }
.tile.done .state { color: var(--good); }
.tile.in-progress { border-color: var(--accent); }
.tile.in-progress .state { color: var(--accent); }

/* --- settings ------------------------------------------------------------ */

.settings {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  max-width: 26rem;
}

.setting h2 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}

.stats-line {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.note {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.segmented {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  overflow: hidden;
}

.segmented button {
  flex: 1 1 0;
  font: inherit;
  font-size: 0.9rem;
  padding: 0.45rem 0;
  border: 0;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.segmented button + button { border-left: 1px solid var(--line); }

.segmented button[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}

.danger {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--bad);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--bad);
  cursor: pointer;
}
