.crypt-cards-game {
  --ccr-ink: #eee5d1;
  --ccr-muted: #b9ad99;
  --ccr-night: #090a10;
  --ccr-panel: #15141d;
  --ccr-panel-2: #201b25;
  --ccr-line: #514535;
  --ccr-brass: #c4a15d;
  --ccr-blood: #8e3545;
  --ccr-soul: #74b78d;
  --ccr-focus: #f0d276;
  color: var(--ccr-ink);
  max-width: 1540px;
  margin: 0 auto;
  padding: clamp(0.75rem, 2vw, 1.5rem);
  border-radius: 1.5rem;
  background:
    radial-gradient(circle at 12% 3%, rgb(113 73 45 / 24%), transparent 24rem),
    radial-gradient(circle at 87% 15%, rgb(65 48 98 / 24%), transparent 30rem),
    linear-gradient(145deg, #131019, var(--ccr-night) 60%);
  box-shadow: 0 1.5rem 5rem rgb(0 0 0 / 38%);
  isolation: isolate;
}

.crypt-cards-game *,
.crypt-cards-game *::before,
.crypt-cards-game *::after {
  box-sizing: border-box;
}

.crypt-cards-game button,
.crypt-cards-game select,
.crypt-cards-game input {
  font: inherit;
}

.crypt-cards-game button,
.crypt-cards-game select,
.crypt-cards-game input {
  min-height: 2.65rem;
  border: 1px solid var(--ccr-line);
  border-radius: 0.55rem;
  color: var(--ccr-ink);
  background: #25212b;
}

.crypt-cards-game button {
  padding: 0.55rem 0.8rem;
  cursor: pointer;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    transform 140ms ease;
}

.crypt-cards-game button:hover:not(:disabled) {
  border-color: var(--ccr-brass);
  background: #332c35;
}

.crypt-cards-game button:active:not(:disabled) {
  transform: translateY(1px);
}

.crypt-cards-game button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.crypt-cards-game :focus-visible {
  outline: 3px solid var(--ccr-focus);
  outline-offset: 3px;
}

.crypt-cards-game h1,
.crypt-cards-game h2,
.crypt-cards-game h3,
.crypt-cards-game p {
  margin-top: 0;
}

.crypt-cards-game h1 {
  margin-bottom: 0.3rem;
  color: #f5e4bc;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 7vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
  text-shadow: 0 4px 25px rgb(159 83 63 / 34%);
}

.crypt-cards-game h2,
.crypt-cards-game h3 {
  color: #efe1c0;
  font-family: Georgia, "Times New Roman", serif;
}

.ccr-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.5rem 1.25rem;
}

.ccr-hero > div:first-child {
  max-width: 62rem;
}

.ccr-hero p:last-child {
  max-width: 50rem;
  margin-bottom: 0;
  color: var(--ccr-muted);
  font-size: 1.02rem;
}

.ccr-kicker {
  margin-bottom: 0.35rem;
  color: var(--ccr-brass);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.ccr-audio,
.ccr-actions,
.ccr-speed,
.ccr-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.ccr-quiet {
  color: var(--ccr-muted) !important;
  background: rgb(19 17 24 / 70%) !important;
}

.ccr-primary {
  border-color: #b78b45 !important;
  color: #fff8e6 !important;
  background: linear-gradient(#9d6f35, #66401f) !important;
  font-weight: 800;
}

.ccr-status-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(5.25rem, 1fr));
  overflow: hidden;
  margin-bottom: 0.8rem;
  border: 1px solid var(--ccr-line);
  border-radius: 0.75rem;
  background: rgb(17 15 22 / 84%);
}

.ccr-status-strip > div {
  padding: 0.58rem 0.75rem;
  border-right: 1px solid #302b32;
}

.ccr-status-strip > div:last-child {
  border-right: 0;
}

.ccr-status-strip span,
.ccr-status-strip strong {
  display: block;
}

.ccr-status-strip span {
  color: var(--ccr-muted);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ccr-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem);
  gap: 0.85rem;
}

.ccr-stage-panel,
.ccr-sidebar > section,
.ccr-sidebar > nav,
.ccr-log,
.ccr-diagnostics {
  border: 1px solid var(--ccr-line);
  border-radius: 0.8rem;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 2%), transparent 38%),
    var(--ccr-panel);
  box-shadow: inset 0 1px rgb(255 255 255 / 4%);
}

.ccr-stage-panel {
  min-width: 0;
  padding: 0.75rem;
}

.ccr-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.ccr-stage-head h2 {
  margin-bottom: 0.4rem;
}

.ccr-speed button {
  min-width: 2.8rem;
}

.ccr-speed button[aria-pressed="true"] {
  border-color: var(--ccr-brass);
  color: #17100a;
  background: var(--ccr-brass);
}

.ccr-canvas-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid #6f5b3e;
  border-radius: 0.65rem;
  background: #07080d;
  touch-action: none;
}

.ccr-canvas-wrap canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1100 / 620;
  max-height: 66vh;
}

.ccr-pause {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  background: rgb(6 6 10 / 86%);
  backdrop-filter: blur(8px);
}

.ccr-pause[hidden] {
  display: none;
}

.ccr-pause strong,
.ccr-pause span {
  display: block;
}

.ccr-pause strong {
  font-family: Georgia, serif;
  font-size: 2rem;
}

.ccr-narrator {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  min-height: 4.5rem;
  margin-top: 0.65rem;
  padding: 0.55rem;
  border: 1px solid #4d4034;
  border-radius: 0.6rem;
  background: linear-gradient(90deg, #211b20, #14131a);
}

.ccr-narrator img {
  width: 3.4rem;
  height: 3.4rem;
  border: 1px solid var(--ccr-brass);
  border-radius: 50%;
  object-fit: cover;
  object-position: 0 82%;
}

.ccr-narrator p {
  margin: 0.1rem 0 0;
  color: var(--ccr-muted);
}

.ccr-context,
.ccr-hand,
.ccr-enemy-list {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding: 0.65rem 0 0.15rem;
  scrollbar-color: var(--ccr-line) transparent;
}

.ccr-context:empty,
.ccr-hand:empty,
.ccr-enemy-list:empty {
  display: none;
}

.ccr-choice,
.ccr-card,
.ccr-enemy {
  position: relative;
  flex: 0 0 auto;
  border: 2px solid #665846 !important;
  text-align: left;
  background: linear-gradient(155deg, #d3c39d, #9c835c) !important;
  color: #211b16 !important;
}

.ccr-choice {
  width: min(17rem, 72vw);
  min-height: 6.5rem !important;
}

.ccr-choice strong,
.ccr-choice span,
.ccr-card strong,
.ccr-card span,
.ccr-enemy strong,
.ccr-enemy span {
  display: block;
}

.ccr-choice span,
.ccr-card span {
  margin-top: 0.3rem;
  font-size: 0.77rem;
}

.ccr-choice,
.ccr-card,
.ccr-enemy,
.ccr-grid-list article {
  overflow-wrap: anywhere;
}

.ccr-card {
  width: 8.3rem;
  min-height: 10.6rem !important;
  padding: 0.55rem !important;
  border-radius: 0.7rem !important;
}

.ccr-card::after {
  content: attr(data-rarity);
  position: absolute;
  right: 0.42rem;
  bottom: 0.35rem;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ccr-card[data-category="Attack"] {
  box-shadow: inset 0 0 0 3px #9c3942;
}

.ccr-card[data-category="Defense"] {
  box-shadow: inset 0 0 0 3px #4b718c;
}

.ccr-card[data-category="Movement"] {
  box-shadow: inset 0 0 0 3px #558052;
}

.ccr-card[data-category="Spell"],
.ccr-card[data-category="Curse"] {
  box-shadow: inset 0 0 0 3px #75518c;
}

.ccr-card[aria-pressed="true"] {
  border-color: #fff2a6 !important;
  transform: translateY(-0.4rem);
}

.ccr-card .ccr-cost {
  display: grid;
  width: 1.8rem;
  height: 1.8rem;
  margin-bottom: 0.35rem;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: #222d47;
  font-weight: 900;
}

.ccr-enemy {
  width: 12rem;
  min-height: 4.7rem !important;
  color: var(--ccr-ink) !important;
  background: #2b2025 !important;
}

.ccr-enemy[aria-pressed="true"] {
  border-color: #f0c96c !important;
}

.ccr-enemy span {
  color: #d6bfc3;
  font-size: 0.78rem;
}

.ccr-actions {
  margin-top: 0.65rem;
}

.ccr-actions kbd {
  margin-left: 0.3rem;
  color: #d8c699;
  background: transparent;
}

.ccr-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ccr-sidebar > section,
.ccr-sidebar > nav {
  padding: 0.85rem;
}

.ccr-sidebar label {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.55rem;
  color: var(--ccr-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.ccr-sidebar select,
.ccr-sidebar input {
  width: 100%;
  padding: 0.4rem 0.5rem;
}

.ccr-sidebar fieldset {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem 0.7rem;
  margin: 0.75rem 0;
  border: 1px solid #3e3640;
  border-radius: 0.5rem;
}

.ccr-sidebar fieldset label,
.ccr-options label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.72rem;
}

.ccr-sidebar input[type="checkbox"] {
  width: 1rem;
  min-height: auto;
  accent-color: var(--ccr-brass);
}

.ccr-wide {
  width: 100%;
  margin-top: 0.45rem;
}

.ccr-character dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0;
}

.ccr-character dl div {
  padding: 0.45rem;
  border: 1px solid #38313a;
  border-radius: 0.45rem;
}

.ccr-character dt {
  color: var(--ccr-muted);
  font-size: 0.66rem;
  text-transform: uppercase;
}

.ccr-character dd {
  margin: 0.1rem 0 0;
  font-size: 0.8rem;
}

.ccr-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.ccr-tabs button {
  min-height: 2.3rem;
  padding: 0.35rem;
  font-size: 0.72rem;
}

.ccr-log,
.ccr-diagnostics {
  margin-top: 0.75rem;
  padding: 0.75rem;
}

.ccr-log summary {
  cursor: pointer;
  font-weight: 800;
}

.ccr-log ol {
  max-height: 12rem;
  overflow: auto;
  margin-bottom: 0;
  color: var(--ccr-muted);
}

.ccr-diagnostics {
  overflow: auto;
  color: #aee7b8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  white-space: pre-wrap;
}

.ccr-dialog {
  width: min(50rem, calc(100vw - 2rem));
  max-height: 82vh;
  padding: 0;
  border: 1px solid var(--ccr-brass);
  border-radius: 0.8rem;
  color: var(--ccr-ink);
  background: #17141d;
  box-shadow: 0 2rem 8rem #000;
}

.ccr-dialog::backdrop {
  background: rgb(3 3 7 / 78%);
  backdrop-filter: blur(5px);
}

.ccr-dialog form {
  padding: 1.1rem;
}

.ccr-dialog [data-ui="dialog-body"] {
  max-height: 56vh;
  overflow: auto;
}

.ccr-dialog-actions {
  justify-content: end;
  margin-top: 1rem;
}

.ccr-grid-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.6rem;
}

.ccr-grid-list article {
  padding: 0.65rem;
  border: 1px solid #443a41;
  border-radius: 0.55rem;
  background: #211d27;
}

.ccr-grid-list article p {
  margin: 0.25rem 0 0;
  color: var(--ccr-muted);
  font-size: 0.8rem;
}

.ccr-live {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.crypt-cards-game.is-high-contrast {
  --ccr-ink: #fff;
  --ccr-muted: #fff;
  --ccr-night: #000;
  --ccr-panel: #000;
  --ccr-panel-2: #050505;
  --ccr-line: #fff;
  --ccr-brass: #ffe800;
  --ccr-focus: #00ffff;
}

.crypt-cards-game.is-high-contrast canvas,
.crypt-cards-game.is-high-contrast .ccr-card,
.crypt-cards-game.is-high-contrast .ccr-enemy {
  border-width: 3px !important;
}

@media (max-width: 980px) {
  .ccr-shell {
    grid-template-columns: 1fr;
  }

  .ccr-sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .ccr-tabs,
  .ccr-options {
    align-content: start;
  }
}

@media (max-width: 720px) {
  .crypt-cards-game {
    padding: 0.55rem;
    border-radius: 0.75rem;
  }

  .ccr-hero {
    align-items: start;
    flex-direction: column;
  }

  .ccr-status-strip {
    grid-template-columns: repeat(4, 1fr);
  }

  .ccr-status-strip > div {
    border-bottom: 1px solid #302b32;
  }

  .ccr-sidebar {
    display: flex;
  }

  .ccr-stage-head {
    align-items: start;
    flex-direction: column;
  }

  .ccr-card {
    width: 7.4rem;
    min-height: 9.5rem !important;
  }

  .crypt-cards-game button,
  .crypt-cards-game select,
  .crypt-cards-game input {
    min-height: 2.75rem;
  }

  .ccr-actions {
    position: sticky;
    z-index: 4;
    bottom: 0.25rem;
    padding: 0.45rem;
    border: 1px solid var(--ccr-line);
    border-radius: 0.65rem;
    background: rgb(15 13 19 / 96%);
  }

  .ccr-actions button {
    flex: 1 1 8rem;
  }

  .ccr-dialog {
    width: calc(100vw - 1rem);
    max-height: 92dvh;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .ccr-canvas-wrap canvas {
    max-height: 72vh;
  }

  .ccr-narrator img {
    display: none;
  }

  .ccr-sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .crypt-cards-game *,
  .crypt-cards-game *::before,
  .crypt-cards-game *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.crypt-cards-game.is-reduced-motion *,
.crypt-cards-game.is-reduced-motion *::before,
.crypt-cards-game.is-reduced-motion *::after {
  transition-duration: 0.01ms !important;
  animation-duration: 0.01ms !important;
}
