/* Design System - CrackRule Custom Modern Light Aesthetic */
:root {
  --color-bg: #f4f4f2; /* premium cream-off-white */
  --color-card: #ffffff;
  --color-border: #e2e8f0;
  --color-border-dark: #111111;
  --color-text: #111111;
  --color-text-muted: #64748b; /* slate gray */
  --color-success: #0052ff; /* Cobalt/Royal Blue */
  --color-error: #e11d48; /* Dark Crimson */
  --color-partial: #64748b;
  
  --font-sans: "Space Grotesque", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  min-height: 100dvh;
  height: 100%;
  width: 100%;
  background: var(--color-bg);
  background: radial-gradient(circle at center, #fafaf8 0%, #ecece9 100%);
  color: var(--color-text);
  font-family: var(--font-sans);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Base Viewport Container */
.game-viewport {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at center, #fafaf8 0%, #ecece9 100%);
}

/* Screen Shells */
.screen {
  display: none;
  opacity: 0;
  transition: opacity 250ms ease;
  flex-direction: column;
  flex: 1;
  width: 100%;
  box-sizing: border-box;
}

.screen.active {
  display: flex;
}

.screen.visible {
  opacity: 1;
}

/* --- STATE 1: WELCOME SCREEN (Centered Column) --- */
.welcome-screen {
  justify-content: center;
  align-items: center;
  padding: 48px 24px;
  text-align: center;
  max-width: 400px;
  margin: 0 auto;
}

.welcome-top {
  margin-top: auto;
}

/* Welcome Screen Gameplay Preview Mockup */
.welcome-preview-card {
  background-color: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
  width: 100%;
  max-width: 320px;
  margin: 16px auto 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.preview-dice-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: 100%;
}

.preview-die {
  border: 1.5px solid var(--color-border-dark) !important;
  border-radius: 6px !important;
  box-shadow: none !important;
  padding: 4px !important;
  gap: 2px !important;
}

.preview-die .pip.active {
  background-color: var(--color-border-dark) !important;
}

.faded-keyboard-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-width: 240px;
  opacity: 0.6;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 30%, rgba(0,0,0,0) 100%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 30%, rgba(0,0,0,0) 100%);
  pointer-events: none;
  user-select: none;
}

.faded-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: 100%;
}

.mock-key {
  aspect-ratio: 1;
  background-color: #ffffff;
  border: 1.5px solid var(--color-border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-muted);
}

.mock-key.font-colored {
  background-color: rgba(0, 82, 255, 0.35) !important;
  border-color: rgba(0, 82, 255, 0.35) !important;
  color: #ffffff !important;
}

.welcome-title {
  font-size: 42px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  color: var(--color-text);
  margin-bottom: 12px;
}

.welcome-subtitle {
  font-size: 16px;
  color: var(--color-text-muted);
  max-width: 290px;
  margin: 0 auto;
  line-height: 1.5;
  font-weight: 500;
}

.welcome-middle {
  margin: 28px 0;
}

.play-btn {
  background-color: var(--color-border-dark);
  color: #ffffff;
  border: 2px solid var(--color-border-dark);
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 14px 64px;
  border-radius: 8px; /* Sleek rectangle border radius */
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  touch-action: manipulation;
}

.play-btn:hover {
  background-color: #2a2a2a;
  border-color: #2a2a2a;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.05);
}

.play-btn:active {
  transform: scale(0.97);
  background-color: #3a3a3a;
  border-color: #3a3a3a;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.welcome-footer {
  margin-bottom: auto; /* Centered grouping by pushing bottom margin auto */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.welcome-date-container {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.welcome-date-container div {
  margin-top: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  opacity: 0.9;
}

.author-credits {
  margin-top: 4px;
}

.x-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.15s;
}

.x-link:hover {
  color: var(--color-success);
}

.x-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  object-fit: cover;
  flex-shrink: 0;
}

.x-icon {
  display: inline-block;
  vertical-align: middle;
}

@keyframes subtle-bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

.x-icon.bounce {
  animation: subtle-bounce 2s infinite ease-in-out;
}

/* --- STATE 2: MAIN GAME SCREEN (Full width headers, Centered Content) --- */
.game-screen {
  justify-content: flex-start;
}

/* Header Wrapper (100% screen width border) */
.header-wrapper {
  width: 100%;
  border-bottom: 1px solid var(--color-border);
  background-color: var(--color-card);
  padding: 0 20px;
  flex-shrink: 0;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  height: 54px;
  position: relative;
}

.header-title {
  font-size: 20px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text);
  cursor: pointer;
  user-select: none;
  transition: opacity 0.15s ease;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.header-title:hover {
  opacity: 0.7;
}

.header-left-btns,
.header-right-btns {
  display: flex;
  gap: 4px;
  align-items: center;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  transition: background-color 0.2s, color 0.2s;
  text-decoration: none;
  box-sizing: border-box;
}

.icon-btn:hover, .icon-btn:focus-visible {
  background-color: #f1f1f3;
  color: var(--color-text);
  outline: none;
}

/* Centered Game Board Container */
.game-board-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: center; /* Center elements vertically close together */
  gap: clamp(10px, 2vh, 20px); /* Unified, flexible, shrinkable gap */
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  padding: 0 20px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

/* Status Area */
.status-area {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  padding: 12px 4px 6px 4px;
  flex-shrink: 0;
}

.phase-indicator {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-success);
  justify-self: center;
}

.streak-circles {
  display: flex;
  gap: 8px;
  justify-self: end;
}

.attempt-text {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--color-text-muted);
  text-transform: uppercase;
  justify-self: start;
}

.attempt-text.warning {
  color: var(--color-error);
}

.streak-circle {
  width: 12px;
  height: 12px;
  border-radius: 2.5px; /* Tech-like square blocks instead of circles */
  border: 2px solid var(--color-border-dark); /* High visibility dark borders */
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.streak-circle.active {
  background-color: var(--color-partial);
  border-color: var(--color-partial);
}

.streak-circle.success {
  background-color: var(--color-success); /* Cobalt Blue */
  border-color: var(--color-success);
  box-shadow: 0 0 8px rgba(0, 82, 255, 0.4);
}

/* Dice Matrix */
.dice-section {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}

.dice-container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  width: 100%;
}

.die {
  aspect-ratio: 1;
  background-color: #ffffff;
  border: 2px solid var(--color-border-dark);
  border-radius: 8px; /* Rounded corners matching logo */
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.05),
    0 1px 3px rgba(0, 0, 0, 0.03); /* Soft elegant shadow */
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: clamp(6px, 1.8vw, 10px);
  gap: clamp(3px, 1vw, 5px);
  align-items: center;
  justify-items: center;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
              border-color 0.3s ease, 
              box-shadow 0.3s ease;
}

.pip {
  width: 62%;
  height: 62%;
  background-color: transparent;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s ease, background-color 0.2s ease;
}

.pip.active {
  background-color: var(--color-border-dark);
  opacity: 1;
}

/* Scoring Dice Highlight (Cobalt Blue) */
.die.highlight {
  border-color: var(--color-success);
  box-shadow: 
    0 4px 12px rgba(0, 82, 255, 0.12),
    0 1px 3px rgba(0, 82, 255, 0.06);
}

.die.highlight .pip.active {
  background-color: var(--color-success);
}

/* Grid Coordinates for Pips */
.pip-tl { grid-area: 1 / 1; }
.pip-tr { grid-area: 1 / 3; }
.pip-ml { grid-area: 2 / 1; }
.pip-mc { grid-area: 2 / 2; }
.pip-mr { grid-area: 2 / 3; }
.pip-bl { grid-area: 3 / 1; }
.pip-br { grid-area: 3 / 3; }

/* Feedback Slot */
.feedback-slot {
  min-height: 24px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  margin: 0; /* Remove auto-margin to prevent layout split */
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
}

.feedback-slot.visible {
  opacity: 1;
}

.feedback-slot.success {
  color: var(--color-success);
}

.feedback-slot.error {
  color: var(--color-error);
}

.feedback-slot.score-reveal {
  color: var(--color-success);
  font-size: 14px;
  animation: scorePulse 0.6s ease-in-out 2;
}

/* Prompt */
.prompt-title {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Input Grid (0 to 15) */
.controls-section {
  width: 100%;
  margin: 0;
  flex-shrink: 0;
}

.answers-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
}

.answers-grid.compact-grid {
  grid-template-columns: repeat(3, 1fr);
  max-width: 260px;
  margin: 0 auto;
}

.answers-grid.disabled {
  pointer-events: none;
}

.answer-btn {
  aspect-ratio: 1;
  background-color: #ffffff;
  border: 1.5px solid var(--color-border);
  border-radius: 8px; /* Square inputs with border-radius */
  color: var(--color-text);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.1s, border-color 0.1s, color 0.1s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  touch-action: manipulation;
}

.answer-btn:active {
  background-color: #f1f1f3;
  border-color: var(--color-text-muted);
  transform: scale(0.94);
}

.answer-btn:focus-visible {
  outline: 2px solid var(--color-success);
  outline-offset: 2px;
}

.answer-btn:focus {
  outline: none;
}

/* Answer button active highlight states */
.answer-btn.correct {
  background-color: var(--color-success) !important;
  border-color: var(--color-success) !important;
  color: #ffffff !important;
}

.answer-btn.incorrect {
  background-color: var(--color-error) !important;
  border-color: var(--color-error) !important;
  color: #ffffff !important;
}

.answer-btn.score-flash {
  background-color: var(--color-success) !important;
  border-color: var(--color-success) !important;
  color: #ffffff !important;
  animation: scorePulse 0.55s ease-in-out 3;
  box-shadow: 0 0 0 3px rgba(0, 82, 255, 0.25);
  transform: scale(1.04);
}

/* MODALS */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease, visibility 200ms ease;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background-color: var(--color-card);
  width: 90%;
  max-width: 390px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 24px;
  box-sizing: border-box;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  position: relative;
  transform: translateY(20px);
  transition: transform 250ms ease;
  max-height: 90dvh;
  overflow-y: auto;
}

.modal-backdrop.active .modal-card {
  transform: translateY(0);
}

.modal-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.15s;
}

.modal-close-btn:hover {
  color: var(--color-text);
}

.modal-close-btn:focus {
  outline: none;
}

.modal-title {
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
  text-align: center;
}

/* Instructions Styling */
.modal-body {
  font-size: 14px;
  color: #333333;
  line-height: 1.5;
}

.instructions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.instruction-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.badge-num {
  width: 20px;
  height: 20px;
  background-color: var(--color-border-dark);
  color: #ffffff;
  border-radius: 4px; /* Square badges to match style */
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
  margin-top: 1px;
}

.example-box {
  background-color: #fafafb;
  border: 1.5px dashed var(--color-border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
}

.example-box h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.example-dice {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.mini-die {
  width: 36px;
  height: 36px;
  padding: 3px;
  gap: 2px;
  border-radius: 6px;
  pointer-events: none;
  border: 2px solid var(--color-border-dark);
  box-shadow: 0 2px 0 var(--color-border-dark);
}

.mini-die .pip {
  width: 60%;
  height: 60%;
}

.badge {
  display: inline-block;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 4px;
  margin: 0 2px;
}

.badge.blue {
  background-color: var(--color-success); /* Cobalt Blue */
  color: #ffffff;
}

.example-text {
  font-size: 12px;
  color: var(--color-text-muted);
}

.modal-divider {
  border: 0;
  height: 1px;
  background-color: var(--color-border);
  margin: 20px 0 16px 0;
}

.spoiler-section {
  width: 100%;
}

.spoiler-toggle {
  background: none;
  border: none;
  color: var(--color-success);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 0;
  transition: color 0.15s ease;
  text-align: left;
}

.spoiler-toggle:hover {
  color: #003ccb;
}

.toggle-arrow {
  transition: transform 0.2s ease;
  margin-left: 8px;
  flex-shrink: 0;
}

.spoiler-toggle.open .toggle-arrow {
  transform: rotate(180deg);
}

.spoiler-content {
  background-color: #fafafb;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 14px;
  margin-top: 8px;
  text-align: left;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.spoiler-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
  color: var(--color-text);
}

.spoiler-content p {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 10px;
}

.spoiler-content ul {
  margin-left: 16px;
  margin-bottom: 10px;
}

.spoiler-content li {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 4px;
}

.spoiler-note {
  font-weight: 600;
  border-top: 1px dashed var(--color-border);
  padding-top: 8px;
  margin-top: 8px;
  margin-bottom: 0 !important;
}

/* Statistics Table Layout */
.stats-table {
  display: flex;
  justify-content: space-around;
  margin: 20px 0 28px 0;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-num {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-text);
}

.stat-label {
  font-size: 11px;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 4px;
  line-height: 1.2;
}

/* End Game Panel */
.stats-ended-panel {
  border-top: 1px solid var(--color-border);
  padding-top: 20px;
  text-align: center;
}

.outcome-title {
  font-size: 18px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.share-btn {
  background-color: var(--color-border-dark);
  color: #ffffff;
  border: none;
  border-radius: 8px; /* Sleek button */
  width: 100%;
  height: 48px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  margin-top: 16px;
  transition: opacity 0.2s;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.share-btn:active {
  opacity: 0.9;
}

/* Rule Panel inside stats when finished */
.modal-rule-panel {
  background-color: #fafafb;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
  text-align: left;
}

.modal-rule-panel h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.modal-rule-panel p {
  font-size: 12.5px;
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background-color: var(--color-border-dark);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
  z-index: 2000;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Animations */
@keyframes rollIn {
  0% {
    opacity: 0;
    transform: translateY(-10px) rotate(-8deg) scale(0.88);
  }
  55% {
    opacity: 1;
    transform: translateY(2px) rotate(3deg) scale(1.03);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(0deg) scale(1);
  }
}

@keyframes scorePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.06); opacity: 0.92; }
}

.die.rolling {
  animation: rollIn 380ms cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.dice-container.shake {
  animation: shake 280ms ease-in-out;
}

@media (max-width: 360px) {
  .status-area {
    grid-template-columns: 1fr 1fr;
    row-gap: 6px;
  }

  .phase-indicator {
    grid-column: 1 / -1;
    justify-self: center;
  }

  .streak-circles {
    justify-self: end;
  }

  .prompt-title {
    font-size: 13px;
  }

  .dice-container {
    gap: 8px;
  }
}

/* Responsive Scaling modifications */
@media (min-height: 700px) {
  .welcome-screen {
    padding: 80px 24px 48px 24px;
  }
  .game-board-container {
    padding-bottom: 28px;
  }
  .status-area {
    padding: 18px 4px 10px 4px;
  }
}

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-delay: 0s !important;
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    scroll-behavior: auto !important;
  }
  .die.rolling {
    animation: none !important;
  }
  .dice-container.shake {
    animation: none !important;
  }
}

/* Training Mode Banner */
.training-mode-banner {
  background-color: rgba(0, 82, 255, 0.08);
  border: 1px dashed var(--color-success);
  color: var(--color-success);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  padding: 8px 12px;
  border-radius: 6px;
  width: 100%;
  margin-top: 8px;
  display: none; /* toggled via JS */
  flex-shrink: 0;
}

/* Archive List styling */
.archive-description {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
  text-align: center;
}

.archive-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}

.archive-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: #fafafb;
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  text-align: left;
}

.archive-item:hover {
  background-color: #f1f1f3;
  border-color: var(--color-border-dark);
}

.archive-item.active-day {
  border-color: var(--color-success);
  background-color: rgba(0, 82, 255, 0.03);
}

.archive-day-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--color-text);
}

.archive-day-rule {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.archive-play-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-success);
}

.archive-item.active-day .archive-play-tag {
  color: var(--color-text-muted);
}

/* System Leaked Score Alert Banner */
.system-alert {
  background-color: rgba(0, 82, 255, 0.08);
  border: 1.5px solid var(--color-success);
  color: var(--color-success);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  padding: 10px 14px;
  border-radius: 8px;
  width: 100%;
  margin-top: 4px;
  margin-bottom: 8px;
  flex-shrink: 0;
  box-sizing: border-box;
  animation: pulseLeak 2s infinite ease-in-out;
}

@keyframes pulseLeak {
  0%, 100% { opacity: 0.95; }
  50% { opacity: 0.7; }
}

/* Hidden Dice style rendering */
.die.hidden-die {
  background-color: var(--color-border-dark) !important;
  border-color: var(--color-border-dark) !important;
  box-shadow: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.die.hidden-die .pip {
  display: none !important;
}

.die.hidden-die::after {
  content: "?";
  color: #ffffff;
  font-size: 26px;
  font-weight: 800;
  font-family: var(--font-sans);
}

/* Cookie Consent Banner Styling */
.cookie-banner {
  position: fixed;
  bottom: 24px;
  right: 24px;
  left: auto;
  transform: translateY(calc(100% + 40px));
  width: calc(100% - 48px);
  max-width: 360px;
  background-color: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border-dark);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-banner.active {
  transform: translateY(0);
}

@media (max-width: 480px) {
  .cookie-banner {
    right: 20px;
    left: 20px;
    width: auto;
    max-width: none;
  }
}

.cookie-content {
  width: 100%;
}

.cookie-text {
  font-size: 12px;
  line-height: 1.5;
  font-weight: 500;
  color: var(--color-text);
  text-align: left;
}

.cookie-btns {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
}

.cookie-btn {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s, opacity 0.15s, transform 0.1s;
  padding: 8px 14px;
}

.cookie-btn.accept {
  background-color: var(--color-success);
  color: #ffffff;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 82, 255, 0.15);
}

.cookie-btn.accept:active {
  transform: scale(0.97);
}

.cookie-btn.decline {
  background-color: transparent;
  color: var(--color-text);
  border: none;
  padding: 8px 12px;
}

.cookie-btn.decline:hover {
  opacity: 0.7;
}

.cookie-btn.decline:active {
  transform: scale(0.97);
}
