/* The Shop menu's management panels (src/ui/panels/): Staff, Build, the
   reviews app and Arrange, inside the panel helper's card (teashop.css
   .ts-sheet), light and dark through teashop.css's tokens and sized by the
   Text size setting. Every state (a free station, a fit, a pin, stars) has
   words and a picture; colour only repeats them. Every rule is scoped to a
   pn- class or to Arrange's body class, ts-arranging. */

/* ---------- what the panels share ---------- */
.pn-section { display: flex; flex-direction: column; gap: 10px; }
.pn-section h3 { margin: 6px 0 0; font-size: 1.05em; font-weight: 900; }
.pn-grid, .pn-list { display: grid; grid-template-columns: 1fr; gap: 10px; align-items: start; }
@media (min-width: 700px) { .pn-grid { grid-template-columns: 1fr 1fr; } }
.ts-card h4, .ts-card h5 { margin: 0; font-weight: 900; }
.ts-card h4 { font-size: 1.05em; }
.ts-card h5 { font-size: 0.95em; color: var(--muted); }
.pn-person-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pn-person-text { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
/* (a name's words do not widen the card; one too wide beside the face at
   its least goes under it) */
.pn-person-text h4 { contain: inline-size; }
.pn-person-head:has(> .pn-person-text > .fit-whole) { flex-wrap: wrap; }
.pn-person-text:has(> .fit-whole) { flex-basis: 100%; }
.pn-face { width: 64px; height: 68px; flex: none; border-radius: 14px; background: var(--surface-2); }
.pn-star-row { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-weight: 800; font-size: var(--ts-small); }
.pn-stars { display: inline-flex; gap: 1px; color: var(--sunset); }
.pn-star { width: 1.15em; height: 1.15em; flex: none; opacity: 0.25; }
.pn-star.on { opacity: 1; }
.pn-cue { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; line-height: 1.2; }
.pn-cue-icon, .pn-icon { width: 1.25em; height: 1.25em; flex: none; fill: currentColor; }
.pn-cue.on { color: var(--accent-text); }
.pn-cue.bad { color: var(--warn); }
.pn-cue.off, .pn-cue.away { color: var(--muted); }
.pn-switch {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 6px 12px;
  border: 2px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--text); font-weight: 800; cursor: pointer;
}
.pn-switch-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pn-switch small { color: var(--muted); font-weight: 700; font-size: var(--ts-small); }
.pn-switch.off { cursor: default; }
.pn-switch.off .toggle { opacity: 0.45; }
/* the menus' tabs, on the panel's own light or dark ground */
.pn-tabs { flex: none; background: var(--surface-2); }
.pn-tabs .tab { font-size: max(13px, min(var(--ts-small), 16px)); font-family: var(--font); }
.pn-tabs .tab:not([aria-selected="true"]) { background: transparent; color: var(--muted); }
/* Help's four tabs at Largest: two rows rather than words past their tabs */
:root[data-text-size="3"] [data-panel="help"] .pn-tabs { flex-wrap: wrap; border-radius: 24px; }
:root[data-text-size="3"] [data-panel="help"] .pn-tabs .tab { flex: 1 1 auto; }
/* (the panel body's lists are indented; these lines are not a list to read) */
.ts-panel-body .ts-lines { padding-left: 0; }
.pn-acts { justify-content: flex-start; }
.pn-acts .btn.small, .pn-arrange-acts .btn.small { white-space: normal; line-height: 1.1; text-align: center; padding-top: 4px; padding-bottom: 4px; font-size: var(--ts-font); }
.pn-acts .btn .pn-icon, .pn-arrange-acts .btn .pn-icon { width: 1.2em; height: 1.2em; }

/* ---------- Staff ---------- */
.pn-trait { display: flex; flex-direction: column; gap: 1px; }
.pn-trait span { font-weight: 700; color: var(--muted); }
.pn-hello { padding: 8px 12px; border-radius: 14px; background: var(--accent-soft); font-style: italic; }
.pn-story summary { min-height: 44px; display: flex; align-items: center; gap: 10px; font-weight: 900; cursor: pointer; list-style: none; }
.pn-story summary::-webkit-details-marker { display: none; }
.pn-story summary::before { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 3px 3px 0; transform: rotate(-45deg); transition: transform 0.15s; }
.pn-story[open] summary::before { transform: rotate(45deg); }
.pn-beat { display: flex; flex-direction: column; gap: 6px; padding: 4px 0 8px 12px; border-left: 3px solid var(--line); }
.pn-beat + .pn-beat { margin-top: 6px; }
.pn-ask { flex-basis: 100%; margin: 0; font-weight: 900; }

/* ---------- friends (src/ui/friends.js), here and on the day summary ---------- */
.fr-yours { display: inline-flex; align-items: center; gap: 5px; font-weight: 900; color: var(--warn); font-size: var(--ts-small); }
.fr-heart { width: 1.2em; height: 1.2em; flex: none; fill: currentColor; color: var(--chile); }
.fr-card { border-color: color-mix(in srgb, var(--chile) 45%, var(--line)); }
.fr-earned { display: flex; align-items: flex-start; gap: 8px; }
.fr-earned .fr-heart { margin-top: 0.1em; }
/* Inviting a friend or making a look, the steps' own Back leads out, so the
   panel's Back and Close would be a second, different Back. */
#panel > .panel:has(.lm, .fr-flow) > .panel-actions, #panel > .panel:has(.lm, .fr-flow) #panelBack { display: none; }
/* (and the panel's own title over the step's: the step's says what it is) */
#panel > .panel:has(.fr-flow) > .ts-panel-head { display: none; }
/* A look maker drawn tight (look-maker.js fit) keeps its own title alone and
   less of the panel's edge. */
#panel > .panel:has(.lm-tight) { padding-top: 10px; padding-bottom: 10px; }
#panel > .panel:has(.lm-tight) > .ts-panel-head { display: none; }

/* ---------- the reviews app ---------- */
/* The rating tiles, three across until the text is too large for a third,
   then two; the stars share the tile's width, never more than it. */
.pn-ratings { display: grid; grid-template-columns: repeat(auto-fit, minmax(max(88px, 5.5em), 1fr)); gap: 8px; }
.pn-rating { gap: 2px; padding: 8px 10px; min-width: 0; }
.pn-rating > span { font-size: var(--ts-small); line-height: 1.15; }
.pn-rating b { font-size: 1.6em; font-variant-numeric: tabular-nums; line-height: 1.05; }
.pn-rating .pn-star-row, .pn-rating .pn-stars { display: flex; width: 100%; }
.pn-rating .pn-star { flex: 0 1 1.15em; width: auto; min-width: 0; height: auto; aspect-ratio: 1; }
.pn-review-text { font-weight: 700; line-height: 1.4; }
.pn-replies { display: flex; flex-direction: column; gap: 6px; }
.pn-reply-option {
  display: flex; flex-direction: column; gap: 3px; min-height: 48px; padding: 8px 12px; text-align: left; cursor: pointer; touch-action: manipulation;
  border: 2px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--text); font: 700 1em/1.3 var(--font);
}
.pn-reply-option b { font-weight: 900; color: var(--accent-text); }
.pn-reply-option:focus-visible, .pn-piece:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.pn-reply.sent { display: flex; flex-direction: column; gap: 3px; padding: 6px 0 6px 12px; border-left: 4px solid var(--accent); }
.pn-reply-kind { display: inline-flex; align-items: center; gap: 6px; font-weight: 900; color: var(--accent-text); }

/* ---------- Build ---------- */
.pn-room-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pn-room-head h4 { flex: 1 1 auto; }
.pn-next { font-weight: 900; }
.pn-adds { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 2px; font-weight: 700; }

/* ---------- Arrange: the picker ---------- */
.pn-hint { margin: 0; font-weight: 700; }
.pn-hand { display: flex; flex-direction: column; gap: 6px; }
.pn-hand-name { display: flex; align-items: center; gap: 8px; font-size: 1.05em; }
.pn-pieces { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 6px; }
.pn-piece {
  display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 6px 8px; text-align: left; cursor: pointer; touch-action: manipulation;
  border: 2px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); font: 800 max(13px, var(--ts-small))/1.15 var(--font);
}
.pn-piece span { flex: 1 1 auto; min-width: 0; }
.pn-piece small { flex: none; color: var(--muted); font-weight: 800; font-variant-numeric: tabular-nums; }
.pn-piece-text { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.pn-piece-text > span { align-self: stretch; }
.pn-piece[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.pn-obj-icon { width: 24px; height: 24px; flex: none; }
.pn-problems { display: flex; flex-direction: column; gap: 4px; }
.pn-problem {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-height: 44px; padding: 6px 10px; text-align: left; cursor: pointer;
  border: 2px solid var(--warn); border-radius: 12px; background: var(--bg); color: var(--warn); font: 800 max(13px, var(--ts-small))/1.2 var(--font);
}
.pn-problem b { color: var(--text); }
.pn-piece[aria-disabled="true"] { opacity: 0.6; cursor: default; }
.pn-piece .pn-locked { display: inline-flex; align-items: center; gap: 3px; }
/* Undo, Tidy and Done stay in reach however far the picker scrolls */
.pn-arrange-acts { flex-wrap: nowrap; position: sticky; bottom: 0; z-index: 1; margin-top: auto; padding: 8px 0 2px; background: var(--surface); }
.pn-arrange-acts .btn { flex: 1 1 0; min-width: 0; }

/* ---------- Arrange: the label over the room ---------- */
.room-overlay > .pn-label {
  position: absolute; left: 0; top: 0; transform: translate(-50%, calc(-100% - 20px)); pointer-events: none;
  display: flex; flex-direction: column; gap: 2px; width: max-content; max-width: min(210px, 60vw); padding: 5px 9px;
  background: var(--surface); color: var(--text); border: 2px solid var(--line); border-radius: 12px;
  box-shadow: 0 4px 14px rgba(46, 42, 38, 0.22); font-size: max(12px, calc(var(--ts-small) * 0.92)); font-weight: 700; line-height: 1.2;
}
.pn-label-line { display: block; }

/* ---------- a panel opened from the day summary ---------- */
/* The menus' top bar stays over the summary (teashop.css), so a panel
   opened from it starts below the bar rather than under it. */
body.ts-summary-up #panel { padding-top: var(--below-hud); }

/* ---------- Arrange: the room shows, the picker lies beside it ---------- */
/* The room's pinned signs, side column and the summary step aside while it is
   arranged, and the panel lets taps through to the room round its card. */
body.ts-arranging #summary, body.ts-arranging .room-pins, body.ts-arranging .side { display: none; }
body.ts-arranging #panel { background: transparent; pointer-events: none; padding: 0; }
body.ts-arranging #panel > .panel { pointer-events: auto; animation: none; gap: 8px; }
body.ts-arranging #panel .panel-title { font-size: clamp(20px, 5.4vmin, 26px); }
body.ts-arranging #panel > .panel > .panel-actions, body.ts-arranging #panelBack { display: none; }
@media (max-width: 599.98px) {
  body.ts-arranging #panel { align-items: flex-end; }
  body.ts-arranging #panel > .panel {
    width: 100%; height: 48%; max-height: 48%; border-radius: 22px 22px 0 0; border-bottom: 0;
    padding: 10px calc(var(--sar) + 12px) calc(var(--sab) + 10px) calc(var(--sal) + 12px);
  }
}
@media (min-width: 600px) {
  body.ts-arranging #panel { justify-content: flex-end; align-items: stretch; padding-top: var(--sat); }
  body.ts-arranging.ts-summary-up #panel { padding-top: var(--below-hud); }
  body.ts-arranging #panel > .panel {
    width: var(--side-w); max-width: none; max-height: none; border-radius: 22px 0 0 22px; border-right: 0;
    padding: 14px calc(var(--sar) + 14px) calc(var(--sab) + 14px) 14px;
  }
}

/* ---------- the price level (panels/price.js) ---------- */
.pn-levels { display: flex; flex-direction: column; gap: 10px; }
.pn-levels .pn-grow { flex: 1 1 auto; min-width: 0; }
.pn-levels .ts-choice .pn-icon { color: var(--accent); width: 1.5em; height: 1.5em; }
