/* ============================================================================
   Promptle shared design system — dark, professional, "terminal-tech".
   Imported by index.html (game), admin.html (control panel), playground.html.
   ============================================================================ */

:root {
  --bg:        #0b0e14;   /* deep slate page */
  --panel:     #11151f;   /* raised card */
  --panel-2:   #0d1117;   /* inset (code/terminal) */
  --line:      #1e2632;   /* hairline border */
  --line-2:    #2a3340;   /* stronger border / hover */
  --fg:        #e6e9ef;   /* primary text */
  --dim:       #8a93a6;   /* secondary text */
  --faint:     #5b6577;   /* hints */
  --accent:    #4ade80;   /* signature green */
  --accent-2:  #22d3ee;   /* cyan, secondary tech accent */
  --accent-dim:rgba(74,222,128,0.13);
  --blue:      #6aa6ff;   /* jira / links */
  --purple:    #a78bfa;
  --bad:       #f87171;
  --warn:      #fbbf24;
  --radius:    8px;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--fg);
  font-family: var(--sans); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--accent-dim); }

/* scrollbars */
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ── App shell ─────────────────────────────────────────────────────────────── */
.pm-app { max-width: 1180px; margin: 0 auto; padding: 16px 18px 18px;
          min-height: 100vh; display: flex; flex-direction: column; }
/* game shell: lock to the viewport so panes scroll internally, page doesn't grow */
.pm-app.fit { height: 100vh; min-height: 0; overflow: hidden; }
/* belt-and-suspenders: stop the PAGE itself from scrolling on the game view */
html:has(.pm-app.fit), body:has(.pm-app.fit) { height: 100%; overflow: hidden; }
/* the visible view fills the remaining height; long views (result) scroll inside */
.pm-app.fit > section:not([hidden]) {
  flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.pm-header { display: flex; align-items: center; justify-content: space-between;
             padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.pm-brand { display: flex; align-items: baseline; gap: 10px; }
.pm-brand .mark {
  font-family: var(--mono); font-weight: 700; letter-spacing: 1px;
  background: var(--accent); color: #04140a; padding: 3px 8px; border-radius: 6px;
}
.pm-brand .name { font-family: var(--mono); font-weight: 600; letter-spacing: 3px; font-size: 15px; }
.pm-header .meta { display: flex; align-items: center; gap: 14px; color: var(--dim); font-size: 12px; }
.pm-header .meta a { color: var(--dim); }
.pm-header .meta a:hover { color: var(--accent); }

/* ── Panes / cards ─────────────────────────────────────────────────────────── */
.pane { background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
        display: flex; flex-direction: column; min-height: 0; }
.pane-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px;
             border-bottom: 1px solid var(--line); color: var(--dim);
             font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; }
.pane-head .ico { color: var(--faint); }
.pane-body { padding: 14px; overflow: auto; }

/* ── Game three-pane layout ────────────────────────────────────────────────── */
.play-grid { display: grid; gap: 14px; margin-top: 14px; flex: 1; min-height: 0;
             grid-template-columns: 1.6fr 1fr;
             grid-template-rows: minmax(0, 1fr) minmax(0, 1.25fr);
             grid-template-areas: "ticket repo" "term term"; }
/* playground isn't viewport-locked (it has the inspector below); give the grid
   real heights so its panes don't collapse, and let the page scroll. */
.pm-app:not(.fit) .play-grid { flex: none; grid-template-rows: 230px 300px; }
.area-ticket { grid-area: ticket; }
.area-repo   { grid-area: repo; }
.area-term   { grid-area: term; }
@media (max-width: 820px) {
  /* narrow: stack the panes and let the page scroll instead of locking height */
  .play-grid { grid-template-columns: 1fr; grid-template-rows: auto;
               grid-template-areas: "ticket" "repo" "term"; }
  .pm-app.fit { height: auto; min-height: 100vh; overflow: visible; }
  .pm-app.fit > section:not([hidden]) { overflow: visible; }
  html:has(.pm-app.fit), body:has(.pm-app.fit) { overflow: visible; }
  .area-ticket .pane-body, .area-repo .pane-body { max-height: 200px; }
  .term-out { min-height: 220px; max-height: 320px; }
}

/* ── Jira-style ticket ─────────────────────────────────────────────────────── */
.ticket-key { font-family: var(--mono); color: var(--blue); font-size: 12px; }
.ticket-title { font-size: 18px; font-weight: 600; margin: 4px 0 12px; color: var(--fg); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { font-size: 11px; padding: 2px 9px; border-radius: 999px;
        border: 1px solid var(--line-2); color: var(--dim); }
.chip.story  { color: var(--accent); border-color: rgba(74,222,128,.4); }
.chip.prio   { color: var(--warn);  border-color: rgba(251,191,36,.4); }
.chip.label  { color: var(--blue);  border-color: rgba(106,166,255,.4); }
.field-label { color: var(--faint); font-size: 11px; letter-spacing: 1px;
               text-transform: uppercase; margin: 14px 0 4px; }
.story-line { color: var(--dim); }
.story-line b { color: var(--fg); font-weight: 600; }
.desc { color: var(--dim); white-space: pre-wrap; }

/* ── GitHub-style repo ─────────────────────────────────────────────────────── */
.repo-sub { color: var(--faint); font-size: 12px; margin-bottom: 8px; font-family: var(--mono); }
.file-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px;
            border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px;
            font-family: var(--mono); font-size: 13px; }
.file-row .fi { color: var(--faint); }
.file-row .fname { flex: 1; color: var(--fg); }
.file-row .ftag { font-size: 10.5px; color: var(--faint); }
.file-row.clickable { cursor: pointer; }
.file-row.clickable:hover { border-color: var(--line-2); }
.file-row.ai { border-color: rgba(74,222,128,.30); }
.file-row.ai .ftag { color: var(--accent); }
.file-row.written .fi { color: var(--accent); }
.file-view { font-family: var(--mono); font-size: 12.5px; white-space: pre;
             color: #c7d0de; background: var(--panel-2); border: 1px solid var(--line);
             border-top: none; border-radius: 0 0 6px 6px; padding: 10px 12px;
             margin: -6px 0 6px; max-height: 240px; overflow: auto; }
.entry-sig { font-family: var(--mono); font-size: 11.5px; color: var(--purple);
             margin-top: 10px; word-break: break-all; }

/* ── Terminal ──────────────────────────────────────────────────────────────── */
.term { background: var(--panel-2); }
.term .pane-body { display: flex; flex-direction: column; gap: 0; padding: 0; }
.term-out { flex: 1; overflow: auto; padding: 12px 14px; font-family: var(--mono);
            font-size: 13px; line-height: 1.55; }
.tl { white-space: pre-wrap; word-break: break-word; margin: 1px 0; }
.tl.you   { color: var(--fg); }
.tl.you .pfx { color: var(--accent); }
.tl.ai    { color: var(--accent); }
.tl.ai .pfx { color: var(--accent); font-weight: 500; }
.tl.sys   { color: var(--faint); }
.tl.err   { color: var(--bad); }
.tl.note  { color: var(--warn); }
.tl.wrote { color: var(--accent); }
.term-inputrow { display: flex; align-items: center; gap: 8px; padding: 10px 14px;
                 border-top: 1px solid var(--line); font-family: var(--mono); font-size: 13px; }
.term-prompt { color: var(--dim); white-space: nowrap; }
.term-prompt .phase { color: var(--accent); }
.term-prompt .caret { color: var(--accent); }
.term-input { flex: 1; background: transparent; border: none; outline: none;
              color: var(--fg); font-family: var(--mono); font-size: 13px; }
.term-input::placeholder { color: var(--faint); }
.term .blink { animation: pmblink 1.1s step-end infinite; }
@keyframes pmblink { 50% { opacity: 0; } }

/* ── Buttons / inputs (shared with admin) ──────────────────────────────────── */
button, .btn { background: var(--accent); color: #04140a; border: none;
               padding: 8px 16px; border-radius: 6px; font-family: var(--sans);
               font-weight: 600; font-size: 13px; cursor: pointer; }
button:hover, .btn:hover { filter: brightness(1.06); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.sec, .btn.sec { background: transparent; color: var(--dim); border: 1px solid var(--line-2); }
button.sec:hover { color: var(--fg); border-color: var(--fg); }
input[type=text], input[type=number], input[type=date], select, textarea {
  background: var(--panel-2); color: var(--fg); border: 1px solid var(--line-2);
  border-radius: 6px; padding: 7px 10px; font-family: var(--sans); font-size: 13px; outline: none; }
textarea { font-family: var(--mono); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }

/* ── Centered states + result ──────────────────────────────────────────────── */
.center { flex: 1; display: flex; flex-direction: column; align-items: center;
          justify-content: center; gap: 14px; text-align: center; padding: 48px 0; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line-2);
           border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pill { display: inline-block; border: 1px solid var(--line-2); border-radius: 999px;
        padding: 3px 12px; color: var(--dim); font-size: 12px; }
.score-big { font-size: 60px; font-weight: 800; color: var(--accent); line-height: 1;
             transition: color .4s ease; }
.score-big.beat { text-shadow: 0 0 22px rgba(74,222,128,.55); }
.score-sub { color: var(--dim); }
.legend { color: var(--faint); font-size: 12px; }
.tline { font-family: var(--mono); font-size: 12.5px; padding: 2px 0; }
.tline.ok { color: var(--accent); }
.tline.bad { color: var(--bad); }
.section-label { color: var(--faint); font-size: 11px; letter-spacing: 1.5px;
                 text-transform: uppercase; margin: 18px 0 8px; }
.codename { color: var(--dim); font-size: 12px; margin: 10px 0 2px; font-family: var(--mono); }
.codebody { font-family: var(--mono); font-size: 12.5px; white-space: pre; color: #c7d0de;
            background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px;
            padding: 12px; max-height: 320px; overflow: auto; }

/* hidden helper */
[hidden] { display: none !important; }
