/* ============================================================
   tbank.css — design system for PMO Portfolio Game
   Light, clean, accent yellow #FFDD2D. No build step.
   ============================================================ */

:root {
  --accent: #FFDD2D;
  --accent-press: #F5D000;
  --bg: #F6F7F8;
  --card: #FFFFFF;
  --ink: #1A1A1A;
  --ink-soft: #333740;
  --muted: #8A9099;
  --line: #E3E5E8;
  --line-soft: #ECEEF0;
  --ok: #2BA84A;
  --ok-bg: #E7F6EB;
  --warn: #C98A00;
  --warn-bg: #FFF4DA;
  --bad: #D93636;
  --bad-bg: #FDE9E9;
  --over: #FF5C5C;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 14px;
  --shadow: 0 2px 8px rgba(20, 24, 31, .06), 0 1px 2px rgba(20, 24, 31, .04);
  --shadow-lg: 0 8px 28px rgba(20, 24, 31, .12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
          "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 .4em; font-weight: 800; line-height: 1.2; }
h1 { font-size: 32px; letter-spacing: -.02em; }
h2 { font-size: 24px; letter-spacing: -.01em; }
h3 { font-size: 19px; }
p  { margin: 0 0 1em; }
a  { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 12px 20px;
}
.topbar .brand { font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.topbar .brand .dot {
  display: inline-block;
  width: 22px; height: 22px;
  background: var(--accent);
  border-radius: 7px;
  margin-right: 8px;
  vertical-align: -4px;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.row { display: flex; flex-wrap: wrap; gap: 16px; }
.col { flex: 1 1 0; min-width: 0; }
.spacer { flex: 1 1 auto; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-title {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 12px;
  letter-spacing: -.01em;
}
.muted { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, transform .05s ease, box-shadow .15s ease, border-color .15s ease;
  background: var(--line-soft);
  color: var(--ink);
}
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid rgba(255, 221, 45, .55); outline-offset: 2px; }

.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: var(--accent-press); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--muted); background: #fff; }

.btn-danger { background: var(--bad-bg); color: var(--bad); }
.btn-danger:hover { background: #fadddd; }

.btn:disabled,
.btn[disabled] {
  opacity: .5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 11px;
}

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.label {
  display: block;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.input,
input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
textarea,
select {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
select { appearance: none; cursor: pointer; }

.input:focus,
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 221, 45, .35);
}
.input::placeholder,
textarea::placeholder { color: #B6BBC2; }

.help { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- Indicators ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: var(--line-soft);
  color: var(--ink-soft);
}
.badge::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.badge-ok   { background: var(--ok-bg);   color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad  { background: var(--bad-bg);  color: var(--bad); }

.stat { display: block; }
.stat .stat-num {
  display: block;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.1;
}
.stat .stat-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 2px;
}

/* ---------- Progress ---------- */
.progress {
  height: 10px;
  background: var(--line-soft);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width .3s ease, background .3s ease;
}
.progress-bar.over { background: var(--over); }

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.tab {
  position: relative;
  padding: 12px 14px;
  font-weight: 700;
  font-size: 15px;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  transition: color .15s ease;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); }
.tab.active::after {
  content: "";
  position: absolute;
  left: 8px; right: 8px;
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
}

/* ---------- Tables ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th,
.table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.table th {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: var(--bg); }
.table tbody tr:last-child td { border-bottom: none; }

/* ---------- Tooltip (data-tip) ---------- */
[data-tip] { position: relative; }
[data-tip]:hover::after,
[data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  transform: translateX(-50%);
  z-index: 100;
  max-width: 260px;
  width: max-content;
  padding: 8px 11px;
  background: #1A1A1A;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  animation: tip-fade .14s ease both;
}
[data-tip]:hover::before,
[data-tip]:focus-visible::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 3px);
  transform: translateX(-50%);
  z-index: 100;
  border: 6px solid transparent;
  border-top-color: #1A1A1A;
  pointer-events: none;
  animation: tip-fade .14s ease both;
}
@keyframes tip-fade {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  margin-left: 5px;
  border-radius: 50%;
  background: var(--line);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
  font-style: normal;
  line-height: 16px;
  cursor: help;
  vertical-align: middle;
  user-select: none;
}
.hint::after { content: "?"; }
.hint:hover { background: var(--accent); color: #000; }

/* ---------- Utilities ---------- */
.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-bold   { font-weight: 800; }
.text-sm     { font-size: 13px; }
.text-lg     { font-size: 18px; }

.hidden { display: none !important; }
.full { width: 100%; }
.nowrap { white-space: nowrap; }

/* ---------- Lang switcher ---------- */
.lang-switcher { display: inline-flex; gap: 4px; }
.lang-switcher button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: all .15s ease;
}
.lang-switcher button:hover { border-color: var(--muted); color: var(--ink); }
.lang-switcher button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  h1 { font-size: 26px; }
  h2 { font-size: 21px; }
  .container { padding: 16px 14px 48px; }
  .grid { grid-template-columns: 1fr; }
  .row { flex-direction: column; gap: 12px; }
  .topbar { padding: 10px 14px; gap: 10px; }
  .tabs { overflow-x: auto; }
  .tab { white-space: nowrap; }
  [data-tip]:hover::after { max-width: 200px; }
}

/* ============================================================
   Player screen — project list, platform variants, project card
   Extends the base language above: same white cards, same yellow
   accent, same radii. The extra structure here is informational:
   every rule below encodes a state a student has to notice
   (chosen variant, missing prerequisite, project in portfolio).
   ============================================================ */

/* ---------- Project list card ---------- */
.pj { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.pj + .pj { margin-top: 0; }               /* the grid supplies the gap */
.pj.selected {
  box-shadow: var(--shadow), 0 0 0 2px var(--accent);
  background: #FFFEF7;
}

.pj-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pj-name { font-size: 17px; font-weight: 800; margin: 0; line-height: 1.25; letter-spacing: -.01em; }
.pj-risk { flex: 0 0 auto; }

.pj-meta { display: flex; flex-wrap: wrap; margin-top: 5px; font-size: 12px; color: var(--muted); }
.pj-meta > span + span {
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}
.pj-code { font-weight: 700; letter-spacing: .02em; color: var(--ink-soft); }

.pj-desc {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pj-open { align-self: flex-start; }

/* Key figures — four numbers a student compares across projects. */
.pj-figs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.fig { min-width: 0; }
.fig-label { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.fig-value {
  display: block;
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.fig-unit { font-size: 11px; font-weight: 600; color: var(--muted); margin-left: 4px; }

/* ---------- Dependencies ---------- */
.pj-deps { display: flex; flex-direction: column; gap: 6px; }
.pj-deprow { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pj-deprow .label { margin: 0; flex: 0 0 auto; }
.pj-depchips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.dep-ok { background: var(--ok-bg); color: var(--ok); }
.dep-missing { background: var(--bad-bg); color: var(--bad); }
.dep-link { border: none; font-family: inherit; cursor: pointer; }
.dep-link:hover { box-shadow: var(--shadow); }

/* ---------- Platform variant tiles ---------- */
.pj-plat .label { margin-bottom: 8px; }
.vt-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.vt {
  --vt-accent: var(--muted);
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  background: #fff;
  transition: border-color .15s ease, background .15s ease;
}
.vt:hover { border-color: var(--muted); }
.vt-on {
  border-color: var(--accent);
  background: #FFFCEB;
  box-shadow: inset 3px 0 0 var(--vt-accent);
}
.vt input { margin-top: 3px; flex: 0 0 auto; }
.vt-body { display: block; min-width: 0; }
.vt-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vt-code {
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  background: var(--vt-accent);
  border-radius: 6px;
  padding: 1px 7px;
}
.vt-name { font-size: 12px; color: var(--muted); min-width: 0; }
.vt-risk { font-size: 11px; padding: 2px 8px; }
.vt-nums { display: flex; gap: 12px; margin-top: 6px; font-size: 12px; color: var(--ink-soft); }
.vt-nums b { font-variant-numeric: tabular-nums; font-size: 13px; }
.vt-effect { display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted); }

.pj-why {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  background: var(--bg);
  border-radius: 12px;
  padding: 10px 12px;
}
.pj-why .label { margin-bottom: 3px; }

.pj-take {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 4px;
  font-weight: 700;
  cursor: pointer;
}
.pj-take input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

.plat-check { cursor: pointer; font-weight: 700; }

/* Violation chips wrap onto several lines — they are sentences now, not keys. */
.viol { display: block; width: 100%; text-align: left; line-height: 1.45; padding: 7px 11px; border-radius: 12px; }

/* ---------- Project card (dialog) ---------- */
.pcard {
  width: min(860px, calc(100vw - 24px));
  max-height: min(88vh, 900px);
  padding: 0;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.pcard::backdrop { background: rgba(20, 24, 31, .45); }
.pcard-close-form { position: sticky; top: 0; height: 0; z-index: 3; }
.pcard-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 34px; height: 34px;
  border: none;
  border-radius: 50%;
  background: var(--line-soft);
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.pcard-close:hover { background: var(--line); }
.pcard-body { overflow-y: auto; max-height: min(88vh, 900px); padding: 22px 24px 26px; }

.pcard-head { padding-right: 44px; border-bottom: 1px solid var(--line-soft); padding-bottom: 14px; }
.pcard-eyebrow { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.pcard-head h2 { font-size: 24px; margin: 0 0 10px; }
.pcard-headmeta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pcard-sponsor { display: flex; align-items: baseline; gap: 6px; }
.pcard-sponsor .label { margin: 0; }

.pcard-section { padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.pcard-section:last-child { border-bottom: none; }
.pcard-section h3 { font-size: 14px; font-weight: 800; color: var(--muted); margin: 0 0 8px; }
.pcard-prose { margin: 0; max-width: 68ch; line-height: 1.6; }
.pcard-kpi { margin: 0; padding-left: 18px; max-width: 68ch; }
.pcard-kpi li { margin-bottom: 5px; line-height: 1.5; }
.pcard-deps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.pcard-deplist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

.pcard-tablewrap { overflow-x: auto; }
.pcard-variants { min-width: 620px; }
.pcard-variants td, .pcard-variants th { padding: 9px 10px; vertical-align: middle; }
.pcard-variants .num { text-align: right; font-variant-numeric: tabular-nums; }
.pcard-variants tr.v-on > td { background: #FFFCEB; }
.pcard-variants tbody tr:hover { background: transparent; }
.pcard-variants .v-code {
  display: inline-block;
  font-weight: 800;
  color: #fff;
  background: var(--vt-accent, var(--muted));
  border-radius: 6px;
  padding: 1px 7px;
  margin-right: 6px;
}
.pcard-variants .v-pname { font-size: 12px; color: var(--muted); }
.pcard-variants tr.v-why td {
  padding-top: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
}
.pcard-exec { background: var(--bg); border-radius: var(--radius-md); padding: 16px; }

@media (max-width: 720px) {
  .pj-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vt-row { grid-template-columns: 1fr; }
  .pcard { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; }
  .pcard-body { max-height: 100vh; padding: 18px 16px 28px; }
  .pcard-head h2 { font-size: 20px; }
}

/* The optimum caveat sits under the number, not beside it. */
.stat .help { display: block; max-width: 42ch; margin-top: 4px; }
/* Long currency labels must not split a figure across two lines. */
.vt-nums { flex-wrap: wrap; row-gap: 2px; }
.vt-nums > span { white-space: nowrap; }

@media (max-width: 600px) {
  .topbar, .topbar .container, .topbar .container > .flex { flex-wrap: wrap; row-gap: 8px; }
  .topbar .container > .flex:last-child { margin-left: auto; }
}
