* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #14151a; color: #e8e6df; font-family: Georgia, serif;
  max-width: 760px; margin: 0 auto; padding: 12px; }
h1 { margin: 12px 0; } h2 { font-size: 14px; margin: 8px 0 4px; opacity: 0.8; }
#setup-screen h1 img { display: block; width: min(100%, 420px); height: auto; margin: 0 auto; }
.hidden { display: none !important; }
button { font: inherit; padding: 8px 14px; margin: 4px; border-radius: 6px;
  border: 1px solid #6b6455; background: #2a2c33; color: #e8e6df; cursor: pointer; }
button:disabled { opacity: 0.4; cursor: default; }
button.secondary-btn { background: transparent; border-color: #4b4f59; color: #c9c3b3; }
label { display: block; margin: 10px 0; }
#setup-screen input[type=checkbox] { margin-right: 8px; }
.setup-blurb { text-align: left; max-width: 420px; margin: 0 auto 12px;
  font-size: 13px; line-height: 1.45; color: #c9c3b3; }
.setup-blurb p { margin: 6px 0; }
#difficulty-result { color: #f0e6c8; }
.ai-style-label { margin: 16px 0 8px; font-size: 15px; }
#ai-styles { display: flex; flex-direction: column; gap: 10px;
  max-width: 420px; margin: 0 auto 16px; }
.ai-style-btn { display: block; width: 100%; margin: 0; padding: 16px 18px;
  text-align: left; border-radius: 10px; border: 2px solid #33363f;
  background: #1d1f26; opacity: 0.65; }
.ai-style-btn.selected { opacity: 1; border-color: #e0a04a; background: #2a2c33; }
.ai-style-btn strong { display: block; font-size: 20px; color: #f0e6c8; }
.ai-style-btn span { display: block; font-size: 13px; opacity: 0.75; margin: 2px 0 8px; }
.ai-style-btn small { display: block; font-size: 13px; line-height: 1.45;
  opacity: 0.9; font-family: inherit; }
#status-bar { display: flex; flex-wrap: wrap; gap: 16px; padding: 8px 0;
  font-size: 15px; border-bottom: 1px solid #33363f; align-items: center; }

/* Draw-pile indicator: a small face-down card stack with the live deck size.
   The current rules declare deck size and Midnight count public information,
   so surfacing this prominently is allowed. */
.deck-info { display: inline-flex; align-items: center; gap: 10px;
  padding: 4px 12px 4px 6px; background: #1d1f26;
  border: 1px solid #33363f; border-radius: 6px; }
.deck-stack { position: relative; width: 36px; height: 50px; flex-shrink: 0; }
.deck-stack-edge, .deck-stack-face {
  position: absolute; width: 30px; height: 44px; border-radius: 4px;
  border: 1px solid #55565b;
}
.deck-stack-edge:nth-child(1) { top: 6px; left: 6px; background: #4b4f59; }
.deck-stack-edge:nth-child(2) { top: 3px; left: 3px; background: #4b4f59; }
.deck-stack-face { top: 0; left: 0;
  background:
    repeating-linear-gradient(45deg, #2a2c33 0 4px, #33363f 4px 8px),
    #2a2c33;
  border-color: #6b6455;
}
.deck-info-text { display: flex; flex-direction: column; line-height: 1.1; }
.deck-info-count { font-size: 22px; font-weight: bold; }
.deck-info-meta { font-size: 11px; opacity: 0.75; }
.deck-info.deck-low .deck-info-count { color: #e0a04a; }
.deck-info.deck-empty .deck-stack-face {
  background: #1d1f26; border-style: dashed; opacity: 0.6;
}
.deck-info.deck-empty .deck-stack-edge { opacity: 0.4; }
#dial { position: relative; width: min(78vw, 420px); aspect-ratio: 1 / 1;
  margin: 14px auto; }

/* Masterwork listing flanking the dial: two columns, one each side.
   Powers come from rules_strike_twelve_solitaire_thematic_v1.4.md. */
#dial-wrap { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 14px 0; }
.masterworks { display: flex; flex-direction: column; gap: 8px;
  flex: 0 1 170px; min-width: 0; }
.masterwork {
  background: #1d1f26; border: 1px solid #33363f; border-left-width: 4px;
  border-radius: 5px; padding: 7px 9px; font-size: 12px; line-height: 1.4;
}
.masterwork .mw-title {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: bold; font-size: 12px; margin-bottom: 4px; color: #f0e6c8;
  gap: 6px;
}
.masterwork .mw-star { color: #e0a04a; font-size: 13px; }
.masterwork .mw-body { font-size: 11.5px; }
.masterwork .mw-meta { font-size: 10px; opacity: 0.6; margin-top: 4px; }
/* metal left-border accent matches the accessible card palette */
.masterwork.metal-Iron   { border-left-color: #49545b; }
.masterwork.metal-Brass  { border-left-color: #a75824; }
.masterwork.metal-Silver { border-left-color: #a7c0cc; }
.masterwork.metal-Gold   { border-left-color: #e3c75a; }
/* dim once the Masterwork Hour has been repaired so its power is spent */
.masterwork.repaired { opacity: 0.45; }
.masterwork.repaired .mw-title { text-decoration: line-through; }
/* narrow screens: stack the masterworks above and below the dial so they
   stay readable on a phone-sized viewport */
@media (max-width: 600px) {
  #dial-wrap { flex-direction: column; }
  .masterworks { flex-direction: row; flex-basis: auto; width: 100%; }
  .masterworks .masterwork { flex: 1 1 0; min-width: 0; }
}
.hour { position: absolute; width: 50px; height: 66px; border-radius: 7px;
  transform: translate(-50%, -50%); text-align: center; cursor: pointer;
  padding-top: 4px; font-weight: bold; }
.hour .hour-num { font-size: 20px; }
.hour .mw { font-size: 12px; }
.hour .done { font-size: 16px; }
.hour.repaired { opacity: 0.4; cursor: default; }
.card { display: inline-block; position: relative; width: 52px; height: 74px; border-radius: 6px;
  margin: 3px; text-align: center; line-height: 74px; font-size: 22px;
  font-weight: bold; cursor: pointer; border: 2px solid transparent;
  user-select: none; font-family: Georgia, serif; }
.card.selected { border-color: #ffffff; transform: translateY(-6px); }
.card.hint { box-shadow: 0 0 0 2px #e0a04a; }
.card.drawn { box-shadow: 0 0 0 2px #f0e6c8; animation: card-drawn 0.7s ease-out; }
@keyframes card-drawn {
  0% { transform: translateY(-10px); box-shadow: 0 0 0 3px #ffffff, 0 8px 16px rgba(240, 230, 200, 0.35); }
  100% { transform: translateY(0); box-shadow: 0 0 0 2px #f0e6c8; }
}
@media (prefers-reduced-motion: reduce) {
  .card.drawn { animation: none; }
}
.hour.hint { box-shadow: 0 0 0 3px #e0a04a; z-index: 1; }
.metal-Iron { background: #49545b; color: #ffffff; --metal-symbol: "▣"; }
.metal-Brass { background: #a75824; color: #ffffff; --metal-symbol: "⊙"; }
.metal-Silver { background: #a7c0cc; color: #1c1c1e; --metal-symbol: "☾"; }
.metal-Gold { background: #e3c75a; color: #1c1c1e; --metal-symbol: "☀"; }
.card[class*="metal-"]::before,
.hour[class*="metal-"]::before {
  content: var(--metal-symbol); position: absolute; z-index: 1;
  display: grid; place-items: center; width: 22px; height: 22px;
  border-radius: 50%; background: #fbf7ec; color: #1f2528;
  border: 1px solid rgba(31, 37, 40, 0.78); line-height: 1;
  font: bold 16px/1 Arial, sans-serif;
}
.card[class*="metal-"]::before { left: 3px; top: 3px; }
.hour[class*="metal-"]::before { left: 3px; bottom: 3px; }
.apprentice { background: #6d4d8c; color: #ffffff; }
.midnight { background: #1a1520; color: #c9c3b3; border-color: #4b3d55; font-size: 16px; }
#workbench, #hand { min-height: 84px; }
#msg { min-height: 20px; color: #e0a04a; font-size: 14px; padding: 2px 0; }
#action-bar { padding: 6px 0; font-size: 15px; }
#undo-bar { display: flex; justify-content: flex-end; margin: 18px 0 2px;
  padding-top: 14px; border-top: 1px dashed #33363f; }
.undo-btn { background: transparent; border-color: #3d4048; color: #8d8778;
  font-size: 13px; padding: 10px 16px; margin: 0; }
.undo-btn:hover:not(:disabled) { color: #c9c3b3; border-color: #6b6455; }
#log { height: 120px; overflow-y: auto; background: #1d1f26; border-radius: 6px; }
  padding: 8px; font-size: 13px; margin-top: 10px; line-height: 1.5; }
#pass-screen, #setup-screen { text-align: center; padding-top: 6vh; }

/* rules modal */
#rules-modal { position: fixed; inset: 0; display: flex; align-items: center;
  justify-content: center; z-index: 100; }
#rules-modal.hidden { display: none !important; }
#rules-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.72); }
#rules-content { position: relative; background: #1d1f26; border: 1px solid #33363f;
  border-radius: 8px; width: min(92vw, 720px); max-height: 86vh;
  display: flex; flex-direction: column; overflow: hidden; }
#rules-header { display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid #33363f; gap: 12px; }
#rules-header h2 { margin: 0; font-size: 18px; }
#rules-close { font-size: 22px; line-height: 1; padding: 2px 10px; margin: 0; }
#rules-body { padding: 14px 20px 20px; overflow-y: auto; line-height: 1.55;
  font-size: 14px; }
#rules-body h3 { margin: 16px 0 8px; font-size: 16px; color: #e8c87a; }
#rules-body h3:first-child { margin-top: 4px; }
#rules-body h4 { margin: 10px 0 4px; font-size: 14px; color: #cfd2da; }
#rules-body p { margin: 4px 0 8px; }
#rules-body ul { margin: 4px 0 8px; padding-left: 22px; }
#rules-body li { margin: 3px 0; }
#rules-body b { color: #f0e6c8; }
#rules-body #rules-setup { border-collapse: collapse; margin: 8px 0 6px; font-size: 13px; }
#rules-body #rules-setup th, #rules-body #rules-setup td { border: 1px solid #33363f;
  padding: 4px 10px; text-align: center; }
#rules-body #rules-setup th { background: #2a2c33; }

#tutorial-screen { position: fixed; inset: 0; display: flex; align-items: center;
  justify-content: center; z-index: 90; background: #14151a; padding: 16px; }
#tutorial-screen.hidden { display: none !important; }
#tutorial-panel { width: min(92vw, 520px); max-height: 92vh; overflow-y: auto;
  text-align: left; background: #1d1f26; border: 1px solid #33363f;
  border-radius: 8px; padding: 18px 20px 16px; }
#tutorial-top { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; }
#tutorial-progress { font-size: 12px; letter-spacing: 0.04em; color: #c9c3b3;
  text-transform: uppercase; }
#tutorial-visual { display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 8px; min-height: 84px; margin: 8px 0 14px; }
#tutorial-visual .card { cursor: default; }
#tutorial-visual .tut-arrow, #tutorial-visual .tut-note {
  font-size: 13px; color: #c9c3b3; }
#tutorial-title { margin: 0 0 8px; font-size: 22px; color: #f0e6c8; }
#tutorial-copy { font-size: 15px; line-height: 1.55; color: #e8e6df; }
#tutorial-copy p { margin: 0 0 8px; }
#tutorial-copy p:last-child { margin-bottom: 0; }
#tutorial-copy b { color: #f0e6c8; }
#tutorial-copy ul { margin: 4px 0 8px; padding-left: 20px; }
#tutorial-copy li { margin: 4px 0; }
#tutorial-dots { display: flex; justify-content: center; gap: 7px; margin: 16px 0 12px; }
#tutorial-dots button { width: 8px; height: 8px; padding: 0; margin: 0;
  border-radius: 50%; border: 0; background: #4b4f59; }
#tutorial-dots button.current { background: #e0a04a; }
#tutorial-nav { display: flex; justify-content: space-between; gap: 8px; }
#tutorial-nav button { min-width: 96px; }
.tut-hours { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.tut-hour { width: 22px; height: 22px; border-radius: 50%; font-size: 11px;
  line-height: 22px; text-align: center; font-weight: bold; }
.tut-strikes { width: 100%; text-align: center; font-size: 13px; color: #e0a04a;
  letter-spacing: 3px; }
.tut-steps { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px;
  font-size: 13px; width: 100%; }
.tut-steps b { color: #e8c87a; }
