/* Base styles of every DVQES Games page, after the DVQES Campus look. System fonts only: the
   pages must load where external resources are blocked. */
:root {
  --brand-primary: #1d3962;
  --navy: #263f58;
  --navy-deep: #1e3349;
  --ink: #182c40;
  --slate: #405972;
  --body: #47596b;
  --line: #d6e0eb;
  --wash: #eaf0f7;
  --card-rest: #f3f6fa;
  --accent: #91a9c4;
  --accent-soft: #dce7f3;
  --muted: #536578;
  --up: #2e6747;
  --down: #a23329;
  --up-wash: #e5f1ea;
  --down-wash: #f8ebe4;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --surface-shadow: 0 4px 20px rgb(30 51 73 / .035), 0 1px 3px rgb(30 51 73 / .025);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--ink);
  background: #f3f6fa;
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-primary); text-underline-offset: 4px; }
:focus-visible { outline: 3px solid #2d72ae; outline-offset: 3px; }

/* ---- header, main, footer ---- */

.app-header {
  max-width: 1480px;
  margin: 0 auto;
  padding: 16px 3%;
  display: flex;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 650;
  letter-spacing: -.01em;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: var(--brand-primary);
  color: white;
  font-size: .8rem;
  font-weight: 700;
}
.app-title { flex: 1; color: var(--slate); font-size: .9rem; }
.app-viewer { color: var(--slate); font-size: .85rem; overflow-wrap: anywhere; }
.app-viewer:not(:empty) { padding: 5px 12px; border: 1px solid var(--line); border-radius: 30px; background: white; }

main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 40px 5% 64px;
  min-height: 70vh;
}
main.narrow { max-width: 820px; }
footer { padding: 28px 5%; color: var(--muted); font-size: .85rem; text-align: center; }

/* ---- typography ---- */

h1, h2, h3 { line-height: 1.12; font-weight: 500; letter-spacing: -.03em; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.75rem, 3vw, 2.5rem); margin: 0 0 24px; }
h2 { font-size: 1.35rem; margin-top: 0; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 20px; }
.eyebrow {
  margin-bottom: 12px;
  color: var(--slate);
  font-size: .73rem;
  font-weight: 650;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.subtle { color: var(--muted); font-size: .85rem; }
.mono { font-family: var(--font-mono); font-size: .8rem; overflow-wrap: anywhere; }
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }

/* ---- forms and buttons ---- */

label { display: block; margin: 18px 0 7px; font-size: .85rem; font-weight: 600; }
input, select, textarea {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid #b6c5d4;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
:is(input, select, textarea):focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 5px rgb(145 169 196 / .14);
}
:is(input, select, textarea):disabled { background: var(--card-rest); color: var(--muted); }
input[aria-invalid='true'] { border-color: var(--down); }

button, .button-link {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--navy-deep);
  border-radius: 9px;
  color: white;
  background: var(--navy-deep);
  font: inherit;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms var(--ease);
}
:is(button, .button-link):active:not(:disabled) { transform: translateY(1px); }
button:hover:not(:disabled), .button-link:hover { background: var(--brand-primary); }
button:disabled { cursor: not-allowed; background: #e4e8ee; border-color: #d5dce5; color: #667085; }
button.secondary, .button-link.secondary { border-color: #b6c5d4; background: white; color: var(--navy-deep); }
button.quiet { border-color: transparent; background: transparent; color: var(--navy-deep); padding: 8px 12px; }
:is(button.secondary, .button-link.secondary, button.quiet):hover:not(:disabled) { background: var(--accent-soft); }
button.danger { background: #922f2a; border-color: #922f2a; }
button.danger:hover:not(:disabled) { background: #772822; border-color: #772822; }
button.small { min-height: 32px; padding: 4px 12px; font-size: .85rem; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-note { margin: 14px 0 0; color: var(--body); font-size: .9rem; }
.form-note:empty { display: none; }

/* ---- notices ---- */

.notice {
  margin-bottom: 24px;
  padding: 14px 18px;
  border: 1px solid #d2b874;
  border-radius: 10px;
  background: #fff8e7;
  font-size: .9rem;
}
.notice.error { border-color: #d8aba6; background: #fff1ef; }
.notice.info { border-color: #b6c5d4; background: #f4f7fb; }
.notice:empty { display: none; }
.toast {
  position: fixed;
  z-index: 30;
  top: 12px;
  left: 50%;
  width: max-content;
  max-width: calc(100vw - 32px);
  margin: 0;
  transform: translateX(-50%);
  box-shadow: 0 8px 30px rgb(30 51 73 / .12);
}

/* ---- surfaces ---- */

.panel, .card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(22px, 3.5vw, 40px);
  box-shadow: var(--surface-shadow);
}
.card { padding: 24px; border-radius: 16px; }
.section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.section-heading h1, .section-heading h2 { margin: 0; }
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 30px;
  background: var(--accent-soft);
  color: var(--slate);
  font-size: .75rem;
  white-space: nowrap;
}
.badge[data-tone='good'] { background: var(--up-wash); color: var(--up); }
.badge[data-tone='bad'] { background: var(--down-wash); color: var(--down); }
.badge[data-tone='live'] { background: var(--navy-deep); color: white; }

.code-chip {
  display: inline-block;
  min-width: 2.4em;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--code);
  color: white;
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 700;
  line-height: 1.6;
  text-align: center;
}

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 12px; margin: 0 0 24px; }
.facts div { padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.facts dt { color: var(--slate); font-size: .75rem; }
.facts dd { margin: 0; font-size: 1.05rem; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ---- tables ---- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  box-shadow: var(--surface-shadow);
}
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .9rem; }
th { background: var(--card-rest); color: var(--slate); font-size: .75rem; letter-spacing: .035em; font-weight: 600; }
th, td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
td { font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #f8fafc; }
tr:last-child td { border-bottom: 0; }
table.compact th, table.compact td { padding: 6px 10px; }
td.r, th.r { text-align: right; }
.empty-row td { color: var(--muted); text-align: center; }

/* ---- dialogs ---- */

dialog {
  max-width: min(560px, 92vw);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  box-shadow: 0 24px 90px rgb(16 36 59 / .22);
}
dialog::backdrop { background: rgb(16 36 59 / .4); }
dialog h2 { margin-bottom: 12px; }
dialog .actions { margin-top: 24px; justify-content: flex-end; }

@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  .view:not([hidden]) { animation: enter 240ms var(--ease); }
}

@media (max-width: 600px) {
  main { padding: 24px 16px 48px; }
  .app-header { padding: 12px 16px; gap: 12px; }
  .field-pair { grid-template-columns: 1fr; }
  th, td { padding: 8px 10px; }
}
