/* ==========================================================================
   Danger Music Number Thirty-Two (for George Maciunas)
   1963 Letterpress / Cardstock Stylesheet
   Pure Vanilla CSS - Zero external dependencies, silent, offline-ready
   ========================================================================== */

:root {
  --bg-primary: #ebe7df;
  --bg-surface: #f7f4ed;
  --bg-surface-hover: #ede8df;
  --border-subtle: #d6cfbf;
  --border-focus: #78716c;

  --text-main: #1f1e1b;
  --text-heading: #141311;
  --text-muted: #57534e;
  --text-dim: #78716c;

  --accent: #141311;
  --accent-highlight: #b91c1c;

  --font-sans: "Courier New", Courier, ui-monospace, monospace;
  --font-mono: "Courier New", Courier, ui-monospace, monospace;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 36px 16px;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

/* Header & Fluxus Score Metadata */
header {
  margin-bottom: 0;
}

.score-meta {
  padding-bottom: 14px;
}

.piece-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-heading);
  line-height: 1.3;
  margin-bottom: 6px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.piece-credit {
  font-size: 0.92rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 14px;
}

.instruction-box {
  background-color: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent-highlight);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 2px rgba(31, 30, 27, 0.03), 0 1px 0 rgba(255, 255, 255, 0.7);
}

.instruction-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-heading);
  letter-spacing: 0.01em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.game-intro {
  font-size: 0.95rem;
  color: var(--text-muted);
  text-align: center;
  margin: 0 auto 6px auto;
  line-height: 1.5;
  max-width: 580px;
}

.credit-attribution {
  font-size: 0.88rem;
  color: var(--text-muted);
  text-align: center;
  margin: 0 0 24px 0;
}

/* Card */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(31, 30, 27, 0.05), inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

/* Perform Now Directive */
.perform-now {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 16px;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* Options Group (Three Buttons) */
.options-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Mechanical Carriage-Return Platen Feed Animation (120ms line ratchet shift) */
@keyframes platenFeed {
  0% {
    transform: translateY(6px);
  }
  65% {
    transform: translateY(-1px);
  }
  100% {
    transform: translateY(0);
  }
}

.options-group.platen-feed {
  animation: platenFeed 120ms cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

@media (prefers-reduced-motion: reduce) {
  .options-group.platen-feed {
    animation: none;
  }
}

.option-btn {
  background-color: #faf8f4;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  font-size: 1.05rem;
  font-family: inherit;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8), inset 0 -1px 1px rgba(31, 30, 27, 0.03), 0 1px 2px rgba(31, 30, 27, 0.04);
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease, opacity 0.3s ease;
  width: 100%;
}

/* Handset Type: Microscopic organic skew on individual option card plates */
.option-btn:nth-child(1) {
  transform: rotate(-0.14deg);
}
.option-btn:nth-child(2) {
  transform: rotate(0.12deg);
}
.option-btn:nth-child(3) {
  transform: rotate(-0.09deg);
}

.option-btn:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-focus);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.9), 0 2px 5px rgba(31, 30, 27, 0.06);
}

.option-btn:nth-child(1):hover {
  transform: translateY(-1px) rotate(-0.14deg);
}
.option-btn:nth-child(2):hover {
  transform: translateY(-1px) rotate(0.12deg);
}
.option-btn:nth-child(3):hover {
  transform: translateY(-1px) rotate(-0.09deg);
}

/* Subtle, ultra-slow 7-second fade on trap buttons after 7 seconds of hesitation */
.option-btn.faded {
  opacity: 0.35;
  transition: opacity 7s ease, border-color 0.15s ease, background-color 0.15s ease, transform 0.05s ease;
}

.option-btn.faded:hover {
  opacity: 0.65;
  transition: opacity 0.2s ease, border-color 0.15s ease, background-color 0.15s ease, transform 0.05s ease;
}

/* Prevent residual hover/focus highlighting between rounds until cursor moves */
.options-group.prevent-hover .option-btn {
  background-color: #faf8f4 !important;
  border-color: var(--border-subtle) !important;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8), inset 0 -1px 1px rgba(31, 30, 27, 0.03), 0 1px 2px rgba(31, 30, 27, 0.04) !important;
  outline: none !important;
}

.options-group.prevent-hover .option-btn:nth-child(1) {
  transform: rotate(-0.14deg) !important;
}
.options-group.prevent-hover .option-btn:nth-child(2) {
  transform: rotate(0.12deg) !important;
}
.options-group.prevent-hover .option-btn:nth-child(3) {
  transform: rotate(-0.09deg) !important;
}

.options-group.prevent-hover .option-btn .option-number {
  background-color: var(--border-subtle) !important;
  color: var(--text-heading) !important;
}

.option-btn:active {
  box-shadow: inset 0 2px 4px rgba(31, 30, 27, 0.08);
}

.option-btn:nth-child(1):active {
  transform: translateY(1px) rotate(-0.14deg);
}
.option-btn:nth-child(2):active {
  transform: translateY(1px) rotate(0.12deg);
}
.option-btn:nth-child(3):active {
  transform: translateY(1px) rotate(-0.09deg);
}

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

/* Option Number / Key Badge [1], [2], [3] */
.option-number {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 30px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  background-color: var(--border-subtle);
  color: var(--text-heading);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: inset 0 1px 1.5px rgba(31, 30, 27, 0.08), 0 1px 0 rgba(255, 255, 255, 0.7);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.option-btn:hover .option-number {
  background-color: var(--text-heading);
  color: #faf8f4;
  box-shadow: inset 0 1px 1.5px rgba(0, 0, 0, 0.2);
  text-shadow: none;
}

.option-content {
  flex: 1;
}

.option-text {
  font-size: 1.02rem;
  font-weight: 500;
  display: block;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

/* Mimeograph ink density & strike variation across handset lines */
.option-btn:nth-child(1) .option-text {
  color: #1f1e1b;
  letter-spacing: -0.008em;
}

.option-btn:nth-child(2) .option-text {
  color: #161513;
  letter-spacing: 0.005em;
}

.option-btn:nth-child(3) .option-text {
  color: #272522;
  letter-spacing: -0.004em;
}

/* Loss Screen */
.loss-screen {
  text-align: center;
  padding: 38px 20px;
  border-color: var(--border-subtle);
}

/* Rubber Stamp Seal ("INVALIDE" - George Maciunas 1963 Cancellation Stamp) */
.stamp-seal {
  display: inline-block;
  margin: 0 auto 16px auto;
  padding: 6px 18px;
  border: 2.5px solid var(--accent-highlight);
  border-radius: 3px;
  background-color: rgba(185, 28, 28, 0.03);
  box-shadow: inset 0 0 0 1px rgba(185, 28, 28, 0.25), 0 0 1px rgba(185, 28, 28, 0.2);
  color: var(--accent-highlight);
  font-family: var(--font-mono);
  text-align: center;
  transform: rotate(-4.5deg);
  user-select: none;
  animation: stampImpact 180ms cubic-bezier(0.1, 0.8, 0.25, 1) forwards;
}

.stamp-title {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  line-height: 1.15;
  text-shadow: 0 0 0.5px rgba(185, 28, 28, 0.4);
}

@keyframes stampImpact {
  0% {
    opacity: 0;
    transform: scale(1.25) rotate(-7deg);
  }
  60% {
    opacity: 0.95;
    transform: scale(0.97) rotate(-4deg);
  }
  100% {
    opacity: 0.92;
    transform: scale(1) rotate(-4.5deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .stamp-seal {
    animation: none;
    transform: rotate(-4.5deg);
  }
}

.loss-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--accent-highlight);
  margin-bottom: 12px;
}

.loss-detail {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin: 0 auto;
  max-width: 520px;
  line-height: 1.5;
}

.loss-time {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin: 10px auto 0 auto;
  max-width: 520px;
  line-height: 1.5;
  font-style: italic;
  letter-spacing: 0.01em;
}

.loss-registry {
  font-size: 0.88rem;
  color: var(--text-dim);
  margin: 8px auto 0 auto;
  max-width: 520px;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

.inaction-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 18px 0 6px 0;
  min-height: 48px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.inaction-area.visible {
  opacity: 1;
  pointer-events: auto;
}

.inaction-notice {
  font-size: 0.92rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  margin: 0;
  line-height: 1.5;
}

.inaction-prompt-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  gap: 10px;
}

.inaction-prompt-text {
  font-size: 0.92rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.5;
}

.inaction-buttons {
  display: inline-flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
}

.btn-inaction {
  background-color: #faf8f4;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 3px 12px;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8), 0 1px 2px rgba(31, 30, 27, 0.04);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease, box-shadow 0.05s ease;
}

.btn-inaction:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-focus);
  color: var(--text-heading);
  transform: translateY(-1px);
}

.btn-inaction:active {
  transform: translateY(1px);
  box-shadow: inset 0 1px 2px rgba(31, 30, 27, 0.1);
}

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

/* Reset Button */
.btn-reset-large {
  background-color: #1f1e1b;
  color: #faf8f4;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 24px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease, box-shadow 0.05s ease;
}

.btn-reset-large:hover {
  background-color: var(--accent-highlight);
  border-color: var(--accent-highlight);
  color: #ffffff;
}

.btn-reset-large:active {
  transform: translateY(1px);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* Loss Screen Maciunas Quote */
.loss-quote {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  text-align: left;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}

.loss-quote-text {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 8px;
}

.loss-quote-cite {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  font-style: normal;
  line-height: 1.5;
}

.loss-quote-cite a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}

.loss-quote-cite a:hover {
  color: var(--text-main);
}

/* Permanent Decision History Card */
.history-card {
  border-color: var(--border-subtle);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.history-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-heading);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.history-empty {
  font-size: 0.88rem;
  color: var(--text-dim);
  font-style: italic;
  padding: 4px 0;
  list-style: none;
}

.history-list {
  padding-left: 28px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-item {
  color: var(--text-main);
  font-size: 0.95rem;
  line-height: 1.5;
  padding: 4px 8px;
  border-left: 3px solid transparent;
  border-radius: var(--radius-sm);
}

.history-item.abided {
  font-weight: 700;
  color: var(--accent-highlight);
  background-color: rgba(185, 28, 28, 0.08);
  border-left-color: var(--accent-highlight);
}

.history-item.abided .history-decision-text,
.history-item.abided strong {
  font-weight: 700;
  color: var(--accent-highlight);
}

.history-item.abided .history-hesitation {
  font-weight: 400;
}

.history-hesitation {
  font-size: 0.82rem;
  color: var(--text-dim);
  font-style: italic;
  margin-left: 6px;
}

/* Footer */
footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 36px;
  padding-bottom: 24px;
}

.footer-context {
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-dim);
  max-width: 580px;
  margin: 0 auto;
}

.footer-attribution {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0;
  margin-bottom: 0;
}

.footer-context a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

.footer-context a:hover {
  color: var(--text-main);
}

/* ==========================================================================
   Laceration / Glitch Effect on Failure
   ========================================================================== */
.laceration-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99999;
  opacity: 0;
}

.laceration-overlay.slash {
  animation: lacerationFlash 180ms cubic-bezier(0.15, 0.85, 0.35, 1) forwards;
}

@keyframes lacerationFlash {
  0% {
    opacity: 0;
    transform: skewX(0deg);
  }
  20% {
    opacity: 0.95;
    background: #dc2626;
    clip-path: polygon(0 42%, 100% 28%, 100% 62%, 0 76%);
  }
  45% {
    opacity: 1;
    background: #ef4444;
    clip-path: polygon(0 15%, 100% 0, 100% 88%, 0 100%);
  }
  70% {
    opacity: 0.85;
    background: #991b1b;
    clip-path: polygon(0 55%, 100% 38%, 100% 74%, 0 92%);
  }
  100% {
    opacity: 0;
    transform: skewX(-4deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .laceration-overlay.slash {
    animation: lacerationSimple 140ms ease-out forwards;
  }
  @keyframes lacerationSimple {
    0% { opacity: 0.8; background: #dc2626; }
    100% { opacity: 0; }
  }
}

/* Responsive */
@media (max-width: 600px) {
  body {
    padding: 20px 12px;
  }
  .card {
    padding: 18px 14px;
  }
  .piece-title {
    font-size: 1.15rem;
  }
  .option-btn {
    padding: 14px 14px;
    font-size: 0.95rem;
  }
}
