/*
 * Tokatçı — görsel katman.
 *
 * Karanlık, sessiz, tipografi ağırlıklı: oyunun gerilimi metinden ve ritimden
 * geliyor, süslemeden değil. Tek bir vurgu rengi var (kırmızı) ve o da yalnızca
 * gerçekten kötü haber için kullanılıyor — risk çubuğu kritikleştiğinde, son
 * ekranında yakalanma manşetinde. Her yerde kırmızı varsa hiçbir yerde kırmızı
 * yoktur.
 */

:root {
  --paper: #151312;
  --paper-lift: #1e1b19;
  --ink: #f4efe4;
  --ink-dim: rgba(244, 239, 228, 0.62);
  --ink-faint: rgba(244, 239, 228, 0.55);
  --rule: rgba(244, 239, 228, 0.16);
  --accent: #c8452f;
  --accent-ink: #e06a4f;
  --good: #7fa650;
  --warn: #c9902f;

  --serif: Georgia, "Times New Roman", "Iowan Old Style", serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;

  --pad: clamp(1rem, 4vw, 1.75rem);
  --measure: 30rem;
  --radius: 3px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100dvh;
  padding: 0 0 env(safe-area-inset-bottom);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: var(--measure);
  margin: 0 auto;
  padding: max(env(safe-area-inset-top), 1rem) var(--pad) 3rem;
}

.screen {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  animation: enter 220ms ease-out;
}

.screen[hidden] {
  display: none;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

h1,
h2,
h3 {
  font-weight: 700;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.35rem;
}

h3 {
  font-size: 1rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
}

p {
  margin: 0;
}

.muted {
  color: var(--ink-dim);
}

.small {
  font-size: 0.85rem;
}

.section-note {
  font-family: var(--mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ----------------------------------------------------------------- home */

.masthead {
  padding: 2.5rem 0 1rem;
  border-bottom: 1px solid var(--rule);
}

.logo {
  font-size: clamp(2.6rem, 14vw, 3.6rem);
  letter-spacing: 0.06em;
  font-weight: 800;
}

.tagline {
  color: var(--ink-dim);
  font-style: italic;
  margin-top: 0.35rem;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.menu__item {
  appearance: none;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  text-align: left;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.menu__item:hover,
.menu__item:focus-visible {
  background: var(--paper-lift);
  border-color: var(--ink-faint);
}

.menu__item--primary {
  border-color: var(--ink);
  font-weight: 700;
}

.menu__item--quiet {
  border-color: transparent;
  color: var(--ink-dim);
  font-size: 0.9rem;
}

.bar-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.6rem;
}

.back {
  appearance: none;
  background: none;
  border: 0;
  color: var(--ink-dim);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  /* 44×44: dokunma hedefi eşiği. Çıplak metin bunun yarısıydı. */
  min-height: 44px;
  padding: 0 0.5rem 0 0;
  display: inline-flex;
  align-items: center;
}

.back:hover {
  color: var(--ink);
}

/* --------------------------------------------------------------- levels */

.level-list {
  display: flex;
  flex-direction: column;
}

.level {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 1rem;
  align-items: center;
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  font: inherit;
  text-align: left;
  padding: 1rem 0.25rem;
  cursor: pointer;
}

.level:disabled {
  cursor: not-allowed;
  color: var(--ink-faint);
}

.level__title {
  font-size: 1.1rem;
  font-weight: 700;
}

.level__sub {
  grid-column: 1;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-dim);
}

.level__stars {
  grid-row: 1 / span 2;
  color: var(--warn);
  letter-spacing: 0.15em;
}

/* -------------------------------------------------------------- opening */

.opening__title {
  font-size: 1.6rem;
}

.opening__lines p {
  margin-bottom: 0.75rem;
  color: var(--ink);
}

.guess {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1rem;
  display: grid;
  gap: 0.6rem;
}

.guess label {
  font-weight: 700;
}

.guess__value {
  font-family: var(--mono);
  font-size: 1.5rem;
  color: var(--accent);
}

input[type='range'] {
  width: 100%;
  accent-color: var(--accent);
}

/* --------------------------------------------------------------- motive */

.motive-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.motive {
  display: grid;
  gap: 0.35rem;
  appearance: none;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--ink);
  font: inherit;
  text-align: left;
  padding: 1rem;
  cursor: pointer;
}

.motive:hover,
.motive:focus-visible {
  background: var(--paper-lift);
}

.motive span {
  color: var(--ink-dim);
  font-size: 0.92rem;
}

/* ----------------------------------------------------------------- play */

.screen--play {
  gap: 0.9rem;
}

.bars {
  display: grid;
  gap: 0.45rem;
}

.bar {
  display: grid;
  grid-template-columns: 3.6rem 1fr auto;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--mono);
  font-size: 0.72rem;
}

.bar__label {
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.bar__track {
  display: block;
  height: 3px;
  background: var(--rule);
  overflow: hidden;
}

.bar__fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ink-dim);
  transition: width 400ms ease;
}

.bar--guven .bar__fill {
  background: var(--good);
}

.bar--para .bar__fill {
  background: var(--ink);
}

.bar.is-warning .bar__fill {
  background: var(--warn);
}

.bar.is-critical .bar__fill {
  background: var(--accent);
}

.bar__value {
  color: var(--ink-dim);
  min-width: 4rem;
  text-align: right;
}

.scene__title {
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
}

.scene__body {
  min-height: 8rem;
  cursor: pointer;
}

.scene__text {
  white-space: pre-wrap;
  font-size: 1.06rem;
}

.echoes:not(:empty) {
  border-left: 2px solid var(--accent);
  padding-left: 0.85rem;
  display: grid;
  gap: 0.4rem;
}

.echo {
  font-style: italic;
  color: var(--ink-dim);
  font-size: 0.95rem;
}

.timer {
  height: 6px;
}

.countdown {
  height: 2px;
  background: var(--rule);
  overflow: hidden;
}

.countdown__fill {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--ink-dim);
}

.countdown.is-urgent .countdown__fill {
  background: var(--accent);
  animation: pulse 700ms ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

.deltas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 1.2rem;
  font-family: var(--mono);
  font-size: 0.75rem;
}

.delta {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.1rem 0.4rem;
  transition: opacity 600ms ease;
}

.delta--up {
  color: var(--good);
  border-color: color-mix(in srgb, var(--good) 45%, transparent);
}

.delta--down {
  color: var(--accent-ink);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

.delta.is-gone {
  opacity: 0;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.choice {
  display: grid;
  gap: 0.3rem;
  appearance: none;
  background: var(--paper-lift);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  text-align: left;
  padding: 0.9rem 1rem;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease;
}

.choice:hover,
.choice:focus-visible {
  border-color: var(--ink);
  transform: translateX(2px);
}

.choice__hint {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
}

.keys {
  margin-top: 0.5rem;
}

/* --------------------------------------------------------------- result */

.result__headline {
  font-size: clamp(1.8rem, 8vw, 2.4rem);
  letter-spacing: 0.04em;
  color: var(--accent);
}

.result__headline.is-good {
  color: var(--good);
}

.stars {
  font-size: 1.8rem;
  letter-spacing: 0.3rem;
  color: var(--warn);
}

.star {
  opacity: 0.25;
}

.star.is-on {
  opacity: 1;
  animation: pop 320ms ease-out;
}

@keyframes pop {
  from {
    transform: scale(0.6);
  }
}

.result__summary {
  font-style: italic;
  color: var(--ink-dim);
}

.report {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  display: grid;
  gap: 0.4rem;
}

.report__row {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.report__note {
  color: var(--ink-dim);
  font-size: 0.9rem;
  border-top: 1px solid var(--rule);
  padding-top: 0.5rem;
  margin-top: 0.2rem;
}

.documentary {
  border-top: 1px solid var(--rule);
  padding-top: 1rem;
  display: grid;
  gap: 0.6rem;
}

.documentary p {
  font-size: 0.94rem;
  color: var(--ink-dim);
}

.documentary .source {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ----------------------------------------------------------- collection */

#collection-body h3 {
  margin-top: 1.2rem;
}

#collection-body ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  color: var(--ink-dim);
}

.collection__total {
  font-family: var(--mono);
  color: var(--warn);
}

.prose {
  display: grid;
  gap: 0.85rem;
  color: var(--ink-dim);
}

.prose strong {
  color: var(--ink);
}

/* ------------------------------------------------------------ a11y/motion */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (min-width: 30rem) {
  body {
    font-size: 18px;
  }
}

@media print {
  body {
    background: #fff;
    color: #000;
  }
}

/* ---------------------------------------------------------------- legend */

/* The bullet marks say how much a resource will move, never which way. The
   rule is worth stating once, plainly, because it is the whole game: reading
   the situation is the skill, and the menu no longer does it for you. */
.legend {
  border-left: 2px solid var(--ink-faint);
  padding-left: 0.85rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

.legend__mark {
  color: var(--ink);
  letter-spacing: 0.15em;
}
