:root {
  color-scheme: light;
  --ink: #203149;
  --ink-soft: #526078;
  --paper: #ffffff;
  --page: #eef7f3;
  --page-blue: #e8f2fb;
  --yellow: #f5c64f;
  --yellow-dark: #9b6a00;
  --coral: #e35f67;
  --coral-dark: #a5313c;
  --teal: #268d88;
  --teal-dark: #14615f;
  --blue: #3e75b6;
  --purple: #77539a;
  --green: #5f8845;
  --green-dark: #3d622b;
  --line: #cad8d6;
  --shadow: 0 4px 0 rgb(32 49 73 / 12%);
  --radius: 8px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --tap: 48px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "Avenir Next", Avenir, "Trebuchet MS", system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: #b9d8d1;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgb(255 255 255 / 20%) 1px, transparent 1px) 0 0 / 28px 28px,
    #b9d8d1;
  overscroll-behavior-y: none;
}

button,
input,
textarea {
  font: inherit;
  font-size: 16px;
}

button {
  min-height: var(--tap);
  border: 2px solid var(--ink);
  border-radius: 6px;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[draggable="true"]:focus-visible {
  outline: 4px solid #155fa0;
  outline-offset: 3px;
}

button:active:not(:disabled) {
  transform: translateY(2px);
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 1.08;
  letter-spacing: 0;
}

p {
  line-height: 1.5;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  padding: 12px;
  color: white;
  background: var(--ink);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: none;
}

#game {
  width: min(100%, 720px);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--page);
  box-shadow: 0 0 40px rgb(32 49 73 / 18%);
}

.screen {
  min-height: 100dvh;
  padding:
    calc(var(--safe-top) + var(--space-4))
    max(var(--space-4), env(safe-area-inset-right, 0px))
    calc(var(--safe-bottom) + var(--space-5))
    max(var(--space-4), env(safe-area-inset-left, 0px));
}

.screen.with-dock {
  padding-bottom: calc(var(--safe-bottom) + 92px);
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.primary-button,
.secondary-button,
.deduction-callout {
  min-height: 52px;
  padding: 12px 16px;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.primary-button {
  color: #18253a;
  border-color: var(--ink);
  background: var(--yellow);
}

.secondary-button {
  color: var(--ink);
  background: white;
}

.compact {
  min-height: 44px;
  padding: 8px 15px;
}

.full-button {
  width: 100%;
}

.text-button {
  min-height: 44px;
  padding: 8px 12px;
  border-color: transparent;
  color: var(--teal-dark);
  background: transparent;
  text-decoration: underline;
  box-shadow: none;
}

.portrait {
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  border: 3px solid white;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px var(--ink);
}

.portrait-large {
  width: 92px;
  height: 92px;
}

.portrait-small {
  width: 44px;
  height: 44px;
  border-width: 2px;
}

.portrait-tiny {
  width: 38px;
  height: 38px;
  border-width: 2px;
}

.app-header {
  display: flex;
  min-height: 58px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.header-copy {
  min-width: 0;
}

.app-header h1 {
  margin: 0;
  font-size: 25px;
  overflow-wrap: anywhere;
}

.app-header .eyebrow {
  margin-bottom: 2px;
}

.bottom-dock {
  position: fixed;
  z-index: 40;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  width: min(100%, 720px);
  min-height: calc(72px + var(--safe-bottom));
  margin: 0 auto;
  padding: 8px max(10px, env(safe-area-inset-right, 0px)) calc(8px + var(--safe-bottom)) max(10px, env(safe-area-inset-left, 0px));
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border-top: 2px solid var(--ink);
  background: rgb(255 255 255 / 96%);
  backdrop-filter: blur(10px);
}

.bottom-dock button {
  min-width: 0;
  min-height: 52px;
  padding: 5px;
  border-color: transparent;
  font-size: 13px;
  font-weight: 800;
  background: transparent;
}

.bottom-dock button.active {
  border-color: var(--ink);
  background: var(--page-blue);
}

.count-badge {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--coral-dark);
  font-size: 11px;
}

.toast-region {
  position: fixed;
  z-index: 100;
  top: calc(var(--safe-top) + 10px);
  right: 12px;
  left: 12px;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.toast {
  max-width: 440px;
  padding: 12px 16px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  color: white;
  background: var(--ink);
  box-shadow: 0 4px 0 rgb(0 0 0 / 20%);
  font-weight: 800;
  text-align: center;
}

@media (min-width: 560px) {
  .screen {
    padding-right: 28px;
    padding-left: 28px;
  }

  .app-header h1 {
    font-size: 30px;
  }
}
