* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, Arial, sans-serif;
  background: radial-gradient(ellipse at top, #1c2440 0%, #0b0f1c 70%) fixed;
  color: #ece6d6;
}

.page-header {
  text-align: center;
  padding: 32px 16px 0;
}
.page-title {
  margin: 0;
  font-family: "David", "Frank Ruhl Libre", Georgia, serif;
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  font-weight: bold;
  letter-spacing: 1px;
  color: #e6c46a;
  text-shadow: 0 2px 18px rgba(230, 196, 106, 0.35);
}
.page-title::after {
  content: "";
  display: block;
  width: min(320px, 60%);
  height: 2px;
  margin: 14px auto 0;
  background: linear-gradient(90deg, transparent, #c9a54a, transparent);
}

.home-header {
  padding-top: clamp(40px, 8vw, 88px);
}
.home-brand {
  margin: 0 0 16px;
  color: #e6c46a;
  font-size: 1.1rem;
}
.home-intro {
  margin: 24px 0 0;
  color: #b5bacb;
  font-size: 1.15rem;
}
.games-home {
  max-width: 940px;
  margin: 0 auto;
  padding: 48px 24px 32px;
}
.games-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.games-heading h2 {
  margin: 0;
  font-size: 1.4rem;
}
.games-count {
  color: #b5bacb;
  font-size: 0.95rem;
}
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}
.game-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(201, 165, 74, 0.35);
  border-radius: 20px;
  background: rgba(20, 26, 46, 0.85);
}
.game-preview {
  display: grid;
  place-items: center;
  min-height: 220px;
  background: radial-gradient(circle, #30365a, #141a2e 75%);
}
.mini-wheel {
  position: relative;
  width: 160px;
  height: 160px;
  border: 6px solid #fff;
  border-radius: 50%;
  background: conic-gradient(
    #ff3b5c 0deg 60deg,
    #ff9f1c 60deg 120deg,
    #ffd60a 120deg 180deg,
    #06d6a0 180deg 240deg,
    #3a86ff 240deg 300deg,
    #8338ec 300deg 360deg
  );
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.mini-wheel::before {
  content: "";
  position: absolute;
  top: -17px;
  left: calc(50% - 12px);
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 26px solid #fff;
}
.mini-wheel::after {
  content: "";
  position: absolute;
  inset: calc(50% - 14px);
  border: 8px solid #fff;
  border-radius: 50%;
  background: #ff3b5c;
}
.game-card-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
  padding: 24px;
}
.game-status {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(6, 214, 160, 0.12);
  color: #6cf0cb;
  font-size: 0.85rem;
}
.game-card h3 {
  margin: 16px 0 8px;
  font-size: 1.7rem;
  color: #e6c46a;
}
.game-card p {
  margin: 0 0 24px;
  color: #b5bacb;
  line-height: 1.7;
}
.play-link {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  margin-top: auto;
  padding: 13px 20px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f3d27a, #b8862b);
  color: #141824;
  font-weight: bold;
  text-decoration: none;
}
.play-link:hover {
  filter: brightness(1.1);
}
.play-link:focus-visible,
.back-link:focus-visible {
  outline: 3px solid #8fd3ff;
  outline-offset: 5px;
}
.coming-soon {
  border-style: dashed;
  border-color: #3a4160;
}
.upcoming-preview {
  background: radial-gradient(circle, #252c45, #141a2e 75%);
}
.upcoming-icon {
  font-size: 6rem;
  color: #777f9c;
}
.upcoming-status {
  background: rgba(181, 186, 203, 0.1);
  color: #b5bacb;
}
.coming-soon-label {
  margin-top: auto;
  color: #b5bacb;
  padding: 13px 0;
}
.home-footer {
  margin: 32px 0 0;
  text-align: center;
  color: #b5bacb;
  font-size: 0.9rem;
}
.game-nav {
  max-width: 1424px;
  margin: 0 auto 24px;
  text-align: start;
}
.back-link {
  display: inline-block;
  padding: 8px 0;
  color: #e6c46a;
  text-decoration: none;
}
.back-link:hover {
  text-decoration: underline;
}

.bh {
  position: absolute;
  top: 10px;
  right: 16px;
  color: #e6c46a;
  font-family: "David", "Frank Ruhl Libre", Georgia, serif;
  font-size: 1.1rem;
  font-weight: bold;
  z-index: 1;
}

.edit-title-btn {
  position: absolute;
  top: 12px;
  left: 16px;
  padding: 6px 12px;
  font-size: 0.95rem;
  background: transparent;
  border: 1px solid rgba(201, 165, 74, 0.4);
  color: #e6c46a;
  font-weight: normal;
}
.edit-title-btn:hover,
.edit-title-btn:focus-visible {
  background: rgba(201, 165, 74, 0.15);
}
.title-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 560px;
  margin: 0 auto;
}
.title-form textarea {
  flex: 1 1 100%;
  min-width: 0;
  resize: vertical;
  background: #0b0f1c;
  border: 1px solid #3a4160;
  color: inherit;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 1.3rem;
  text-align: center;
}
#title-text {
  white-space: pre-line;
}
.secondary-btn {
  background: transparent;
  border: 1px solid #3a4160;
  color: #b5bacb;
  font-weight: normal;
}
.site-footer {
  padding: 24px 16px 32px;
  text-align: center;
  color: #7d8399;
  font-size: 0.9rem;
}
@media (max-width: 600px) {
  .games-grid {
    grid-template-columns: 1fr;
  }
  .games-home {
    padding: 32px 16px;
  }
}

.layout {
  display: flex;
  flex-direction: column;
  gap: 32px;
  align-items: center;
  padding: 32px 16px;
}

.panels {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: center;
  align-items: flex-start;
}

.panel {
  background: rgba(20, 26, 46, 0.85);
  border: 1px solid rgba(201, 165, 74, 0.25);
  border-radius: 16px;
  padding: 24px;
  width: min(340px, 100%);
}

.panel h2 {
  margin: 0 0 16px;
  font-family: "David", "Frank Ruhl Libre", Georgia, serif;
  font-size: 2rem;
  color: #e6c46a;
}

.add-form {
  display: flex;
  gap: 8px;
}
.add-form input[type="text"] {
  flex: 1;
  min-width: 0;
}

input {
  background: #0b0f1c;
  border: 1px solid #3a4160;
  color: inherit;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 1rem;
}
input[type="number"] {
  width: 70px;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 1rem;
  background: #c9a54a;
  color: #141824;
  font-weight: 600;
}
button:disabled,
input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.entries {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 440px;
  overflow-y: auto;
  padding-inline-end: 4px;
  scrollbar-width: thin;
  scrollbar-color: #c9a54a transparent;
}
.entries li {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0b0f1c;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 1.1rem;
}
.entry-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.remove {
  background: transparent;
  color: #ff6b6b;
  padding: 4px 8px;
}

.prizes li.next {
  outline: 2px solid #ffd84f;
}
.prizes li.awarded .entry-name {
  color: #99a;
}
.prize-num {
  font-weight: bold;
  color: #ffd84f;
  min-width: 1.8em;
}
.prize-winner {
  color: #8fd3ff;
  font-weight: bold;
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary {
  color: #99a;
  font-size: 0.9rem;
  margin: 12px 0 0;
}

.wheel-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.wheel-wrap {
  position: relative;
  width: min(680px, 92vw);
  filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.6));
}
.wheel-wrap::before {
  content: "";
  position: absolute;
  inset: -8%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.18),
    transparent 65%
  );
  z-index: -1;
}
.wheel-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
}

.pointer {
  position: absolute;
  top: -24px;
  left: 50%;
  width: 56px;
  height: 74px;
  transform: translateX(-50%);
  transform-origin: 50% 10%;
  z-index: 1;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6));
}
.pointer svg {
  display: block;
  width: 100%;
  height: 100%;
}
.pointer.tick {
  animation: tick 0.12s ease-out;
}
@keyframes tick {
  40% {
    transform: translateX(-50%) rotate(-14deg);
  }
}

.spin-btn {
  font-size: 1.5rem;
  padding: 16px 64px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f3d27a, #b8862b);
  color: #141824;
  font-weight: bold;
  letter-spacing: 1px;
  box-shadow: 0 6px 20px rgba(201, 165, 74, 0.35);
}

.reset-btn {
  background: transparent;
  border: 1px solid #3a4160;
  color: #99a;
  font-weight: normal;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
}
.fireworks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.modal-content {
  position: relative;
  z-index: 1;
  background: rgba(30, 35, 53, 0.92);
  padding: 56px 80px;
  width: min(720px, 92vw);
  border: 3px solid #ffd84f;
  border-radius: 24px;
  box-shadow: 0 0 40px rgba(255, 216, 79, 0.5);
  text-align: center;
  animation: pop 0.5s ease-out;
}
.modal-content p {
  margin: 0;
  font-size: 1.8rem;
}
.modal-content h2 {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  margin: 16px 0;
  color: #ffd84f;
  text-shadow: 0 0 20px rgba(255, 216, 79, 0.7);
  word-break: break-word;
}
.modal-content .prize {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: bold;
  color: #8fd3ff;
  margin-bottom: 32px;
}
.modal-content button {
  font-size: 1.2rem;
  padding: 12px 36px;
}

@keyframes pop {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ---------- Giant dice ---------- */
.dice-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  padding: 16px 16px 32px;
}
.dice-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
.dice-scene {
  --size: min(320px, 62vw);
  width: var(--size);
  height: var(--size);
  /* Room for the cube's corners while it spins (half-diagonal ≈ 0.87 × size). */
  margin: calc(var(--size) * 0.4) 0;
  perspective: 1100px;
}
.dice {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 2.2s cubic-bezier(0.17, 0.67, 0.21, 1);
  cursor: pointer;
  outline: none;
}
.dice:focus-visible .dice-face {
  outline: 3px solid #8fd3ff;
}
.dice-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
  border: 6px solid #fff;
  border-radius: 28px;
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.35), transparent 60%),
    var(--face-color, #3a86ff);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.25);
  backface-visibility: hidden;
  transition: box-shadow 0.3s;
}
.dice-face[data-face="0"] { transform: rotateY(0deg) translateZ(calc(var(--size) / 2)); }
.dice-face[data-face="1"] { transform: rotateY(90deg) translateZ(calc(var(--size) / 2)); }
.dice-face[data-face="2"] { transform: rotateY(180deg) translateZ(calc(var(--size) / 2)); }
.dice-face[data-face="3"] { transform: rotateY(-90deg) translateZ(calc(var(--size) / 2)); }
.dice-face[data-face="4"] { transform: rotateX(90deg) translateZ(calc(var(--size) / 2)); }
.dice-face[data-face="5"] { transform: rotateX(-90deg) translateZ(calc(var(--size) / 2)); }
.dice-face.winner {
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.25), 0 0 60px 10px rgba(255, 214, 10, 0.75);
}
.dice-emoji {
  font-size: calc(var(--size) * 0.45);
  line-height: 1;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.3));
}
.dice-face img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dice-label {
  position: relative;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: calc(var(--size) * 0.09);
  font-weight: bold;
}
.dice-face.has-image .dice-label {
  position: absolute;
  bottom: 12px;
}
.dice-result {
  position: relative;
  z-index: 2;
  min-height: 1.4em;
  margin: 0;
  font-family: "David", "Frank Ruhl Libre", Georgia, serif;
  font-size: clamp(2rem, 6vw, 3.4rem);
  font-weight: bold;
  color: #e6c46a;
  text-align: center;
}
.dice-result.show {
  animation: dice-pop 0.5s ease-out;
}
@keyframes dice-pop {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}
.picker.settings {
  width: min(600px, 94vw);
}
.dice-settings-hint {
  color: #b5bacb;
  font-size: 0.95rem;
}
.face-editor {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.face-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.face-row input[type="text"] {
  flex: 1;
  min-width: 0;
}
.face-thumb {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  padding: 0;
  overflow: hidden;
  border: 2px solid #fff;
  border-radius: 10px;
  background: var(--face-color);
  font-size: 1.6rem;
  transition: transform 0.15s;
}
.face-thumb:hover,
.face-thumb:focus-visible {
  transform: scale(1.1);
  outline: 3px solid #8fd3ff;
}
.dice-duration {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #b5bacb;
}
.dice-duration input {
  width: 64px;
  text-align: center;
}

.picker {
  width: min(760px, 94vw);
  max-height: 86vh;
  padding: 0;
  border: 1px solid rgba(201, 165, 74, 0.45);
  border-radius: 20px;
  background: #141a2e;
  color: #ece6d6;
}
.picker::backdrop {
  background: rgba(0, 0, 0, 0.65);
}
.picker-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #141a2e;
  border-bottom: 1px solid #2a3150;
}
.picker-header h2 {
  margin: 0;
  color: #e6c46a;
  font-size: 1.4rem;
}
.picker-body {
  padding: 4px 20px 20px;
}
.picker-body h3 {
  margin: 18px 0 10px;
  color: #b5bacb;
  font-size: 1.05rem;
}
.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}
.picker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border: 1px solid #2a3150;
  background: #0b0f1c;
  color: #ece6d6;
  font-size: 0.85rem;
  font-weight: normal;
}
.picker-item:hover,
.picker-item:focus-visible {
  border-color: #e6c46a;
  background: #1c2440;
  outline: none;
}
.picker-emoji {
  font-size: 2.2rem;
  line-height: 1;
}
.face-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Mini dice preview on the home screen */
.mini-dice {
  --size: 110px;
  position: relative;
  width: var(--size);
  height: var(--size);
  transform-style: preserve-3d;
  transform: rotateX(-25deg) rotateY(-35deg);
}
.mini-dice span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 4px solid #fff;
  border-radius: 18px;
  font-size: 3.4rem;
}
.mini-dice span:nth-child(1) { background: #ffb703; transform: translateZ(55px); }
.mini-dice span:nth-child(2) { background: #ef233c; transform: rotateY(90deg) translateZ(55px); }
.mini-dice span:nth-child(3) { background: #3a86ff; transform: rotateX(90deg) translateZ(55px); }
.dice-preview {
  perspective: 600px;
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: absolute;
  top: 12px;
  left: 16px;
  display: flex;
  padding: 3px;
  border: 1px solid rgba(201, 165, 74, 0.4);
  border-radius: 999px;
}
.theme-toggle button {
  padding: 6px 14px;
  border-radius: 999px;
  background: transparent;
  color: #b5bacb;
  font-size: 0.95rem;
  font-weight: normal;
}
.theme-toggle button[aria-pressed="true"] {
  background: #c9a54a;
  color: #141824;
  font-weight: 600;
}

/* ---------- Light theme (light blue) ---------- */
html[data-theme="light"] body {
  background: radial-gradient(ellipse at top, #f5fbff 0%, #d4ebfa 75%) fixed;
  color: #1c3a52;
}
html[data-theme="light"] .page-title,
html[data-theme="light"] .game-card h3,
html[data-theme="light"] .panel h2,
html[data-theme="light"] .dice-result,
html[data-theme="light"] .picker-header h2,
html[data-theme="light"] .bh,
html[data-theme="light"] .back-link,
html[data-theme="light"] .edit-title-btn,
html[data-theme="light"] .home-brand {
  color: #1f6fa8;
  text-shadow: none;
}
html[data-theme="light"] .page-title::after {
  background: linear-gradient(90deg, transparent, #5fb3e6, transparent);
}
html[data-theme="light"] .edit-title-btn,
html[data-theme="light"] .theme-toggle {
  border-color: #9fcdec;
}
html[data-theme="light"] .home-intro,
html[data-theme="light"] .games-count,
html[data-theme="light"] .game-card p,
html[data-theme="light"] .coming-soon-label,
html[data-theme="light"] .home-footer,
html[data-theme="light"] .dice-settings-hint,
html[data-theme="light"] .dice-duration,
html[data-theme="light"] .picker-body h3,
html[data-theme="light"] .summary,
html[data-theme="light"] .site-footer,
html[data-theme="light"] .theme-toggle button {
  color: #4f6b80;
}
html[data-theme="light"] button {
  background: #3d9ad8;
  color: #fff;
}
html[data-theme="light"] .theme-toggle button {
  background: transparent;
}
html[data-theme="light"] .theme-toggle button[aria-pressed="true"] {
  color: #fff;
  background: #3d9ad8;
}
html[data-theme="light"] .play-link,
html[data-theme="light"] .spin-btn {
  background: linear-gradient(135deg, #8fd3fa, #2f86c8);
  color: #fff;
  box-shadow: 0 6px 18px rgba(47, 134, 200, 0.3);
}
html[data-theme="light"] .game-card,
html[data-theme="light"] .panel {
  background: rgba(255, 255, 255, 0.9);
  border-color: #b9dcf2;
  box-shadow: 0 8px 24px rgba(31, 111, 168, 0.12);
}
html[data-theme="light"] .coming-soon {
  border-color: #b9dcf2;
}
html[data-theme="light"] .game-preview {
  background: radial-gradient(circle, #f2f9ff, #cfe7f8 75%);
}
html[data-theme="light"] .upcoming-preview {
  background: radial-gradient(circle, #f5f9fc, #dde9f2 75%);
}
html[data-theme="light"] .upcoming-icon {
  color: #9ab4c8;
}
html[data-theme="light"] .game-status {
  background: rgba(6, 160, 120, 0.12);
  color: #087a5c;
}
html[data-theme="light"] .game-status.upcoming-status {
  background: rgba(79, 107, 128, 0.1);
  color: #4f6b80;
}
html[data-theme="light"] input,
html[data-theme="light"] .title-form textarea,
html[data-theme="light"] .entries li,
html[data-theme="light"] .picker-item {
  background: #fff;
  border-color: #b9dcf2;
  color: #1c3a52;
}
html[data-theme="light"] .entries li {
  border: 1px solid #d6eaf7;
}
html[data-theme="light"] .entries {
  scrollbar-color: #5fb3e6 transparent;
}
html[data-theme="light"] .picker-item:hover,
html[data-theme="light"] .picker-item:focus-visible {
  background: #eaf6ff;
  border-color: #3d9ad8;
}
html[data-theme="light"] .secondary-btn,
html[data-theme="light"] .reset-btn,
html[data-theme="light"] .edit-title-btn {
  background: transparent;
  border-color: #9fcdec;
  color: #4f6b80;
}
html[data-theme="light"] .edit-title-btn {
  color: #1f6fa8;
}
html[data-theme="light"] .edit-title-btn:hover,
html[data-theme="light"] .edit-title-btn:focus-visible {
  background: rgba(61, 154, 216, 0.12);
}
html[data-theme="light"] .remove {
  background: transparent;
  color: #e04b5a;
}
html[data-theme="light"] .face-thumb {
  background: var(--face-color);
}
html[data-theme="light"] .prize-num {
  color: #2f86c8;
}
html[data-theme="light"] .prize-winner {
  color: #0b6e4f;
}
html[data-theme="light"] .prizes li.awarded .entry-name {
  color: #8aa1b3;
}
html[data-theme="light"] .picker,
html[data-theme="light"] .picker-header {
  background: #f5fbff;
  color: #1c3a52;
}
html[data-theme="light"] .picker,
html[data-theme="light"] .picker-header {
  border-color: #b9dcf2;
}
html[data-theme="light"] .picker::backdrop {
  background: rgba(20, 50, 80, 0.4);
}
html[data-theme="light"] .wheel-wrap::before {
  background: radial-gradient(circle, rgba(143, 211, 250, 0.45), transparent 65%);
}
html[data-theme="light"] .wheel-wrap,
html[data-theme="light"] .dice-scene {
  filter: drop-shadow(0 12px 24px rgba(31, 111, 168, 0.28));
}html[data-theme="light"] input:focus,
html[data-theme="light"] .title-form textarea:focus {
  outline: 2px solid #3d9ad8;
  outline-offset: 0;
}
html[data-theme="light"] .prizes li.next {
  outline-color: #3d9ad8;
}

/* ---------- Shopping list ---------- */
.shop-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 32px 16px;
}
.panel.shop-panel {
  width: min(760px, 100%);
}
select {
  background: #0b0f1c;
  border: 1px solid #3a4160;
  color: inherit;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 1rem;
  font-family: inherit;
}
.shop-form {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px 16px;
}
.shop-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.shop-field > span {
  color: #b5bacb;
  font-size: 0.9rem;
}
.shop-field input,
.shop-field select {
  width: 100%;
  min-width: 0;
}
.shop-new-cat {
  grid-column: 1 / -1;
}
.shop-inline {
  display: flex;
  gap: 8px;
}
.shop-inline input {
  flex: 1;
}
.shop-field-restock input {
  flex: 0 0 90px;
  width: 90px;
}
.shop-field-restock select {
  flex: 1;
  width: auto;
}
.shop-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
}
.shop-actions button[type="submit"] {
  flex: 1;
  padding: 12px;
  font-size: 1.1rem;
}
.shop-list-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.shop-list-header h2 {
  margin: 0;
}
.shop-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.shop-toolbar button[aria-pressed="true"] {
  border-color: #c9a54a;
  color: #e6c46a;
}
.shop-group h3 {
  margin: 20px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #2a3150;
  color: #e6c46a;
  font-size: 1.15rem;
}
.shop-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.shop-list > .shop-items {
  margin-top: 8px;
}
.shop-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #0b0f1c;
}
.shop-item input[type="checkbox"] {
  flex: none;
  width: 22px;
  height: 22px;
  accent-color: #06d6a0;
  cursor: pointer;
}
.shop-item-body {
  flex: 1;
  min-width: 0;
}
.shop-item-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.shop-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.1rem;
}
.shop-item-qty {
  flex: none;
  color: #e6c46a;
  font-weight: bold;
}
.shop-item-meta {
  color: #99a;
  font-size: 0.85rem;
}
.shop-item-meta:empty {
  display: none;
}
.shop-item.bought {
  opacity: 0.55;
}
.shop-item.bought .shop-item-name {
  text-decoration: line-through;
}
.shop-item.due {
  border-color: #ff9f1c;
}
.shop-due {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 159, 28, 0.15);
  color: #ffb54d;
  font-size: 0.8rem;
}
.shop-icon-btn {
  flex: none;
  padding: 4px 8px;
  background: transparent;
  color: #b5bacb;
  font-weight: normal;
}
.shop-icon-btn.remove {
  color: #ff6b6b;
}
.mini-cart {
  font-size: 6rem;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.35));
}
@media (max-width: 600px) {
  .shop-form {
    grid-template-columns: 1fr;
  }
}

html[data-theme="light"] select {
  background: #fff;
  border-color: #b9dcf2;
  color: #1c3a52;
}
html[data-theme="light"] .shop-field > span,
html[data-theme="light"] .shop-item-meta {
  color: #4f6b80;
}
html[data-theme="light"] .shop-item {
  background: #fff;
  border-color: #d6eaf7;
}
html[data-theme="light"] .shop-item.due {
  border-color: #ff9f1c;
}
html[data-theme="light"] .shop-due {
  color: #b45f00;
}
html[data-theme="light"] .shop-item-qty,
html[data-theme="light"] .shop-group h3,
html[data-theme="light"] .shop-toolbar button[aria-pressed="true"] {
  color: #1f6fa8;
}
html[data-theme="light"] .shop-group h3 {
  border-bottom-color: #d6eaf7;
}
html[data-theme="light"] .shop-toolbar button[aria-pressed="true"] {
  border-color: #3d9ad8;
}
html[data-theme="light"] .shop-icon-btn {
  background: transparent;
  color: #4f6b80;
}
html[data-theme="light"] .shop-icon-btn.remove {
  color: #e04b5a;
}
html[data-theme="light"] .mini-cart {
  filter: drop-shadow(0 8px 18px rgba(31, 111, 168, 0.3));
}

/* Quantity stepper + autocomplete */
.shop-field-name {
  position: relative;
}
.qty-control {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.qty-control input {
  flex: 1;
  min-width: 0;
  width: auto;
  text-align: center;
  -moz-appearance: textfield;
}
.qty-control input::-webkit-outer-spin-button,
.qty-control input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.qty-arrows {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.qty-arrows button {
  flex: 1;
  padding: 0 8px;
  font-size: 0.65rem;
  line-height: 1;
  border-radius: 5px;
}
.qty-control select {
  flex: none;
  width: auto;
}
.shop-suggestions {
  position: absolute;
  top: 100%;
  inset-inline: 0;
  z-index: 5;
  margin: 4px 0 0;
  padding: 4px;
  list-style: none;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #3a4160;
  border-radius: 10px;
  background: #141a2e;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}
.shop-suggestions li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.shop-suggestions li small {
  color: #99a;
  font-size: 0.8rem;
}
.shop-suggestions li[aria-selected="true"],
.shop-suggestions li:hover {
  background: rgba(201, 165, 74, 0.18);
}
html[data-theme="light"] .shop-suggestions {
  border-color: #b9dcf2;
  background: #fff;
  box-shadow: 0 10px 28px rgba(31, 111, 168, 0.18);
}
html[data-theme="light"] .shop-suggestions li small {
  color: #4f6b80;
}
html[data-theme="light"] .shop-suggestions li[aria-selected="true"],
html[data-theme="light"] .shop-suggestions li:hover {
  background: #e3f2fc;
}

/* Backup panel */
.panel.backup-panel {
  width: 100%;
  margin-top: 32px;
}
.backup-panel h2 {
  font-size: 1.5rem;
}
.backup-hint {
  margin: 0 0 16px;
  color: #b5bacb;
  line-height: 1.6;
}
.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.backup-status {
  min-height: 1.2em;
  margin: 12px 0 0;
  color: #6cf0cb;
  font-size: 0.95rem;
}
.backup-status.error {
  color: #ff6b6b;
}
html[data-theme="light"] .backup-hint {
  color: #4f6b80;
}
html[data-theme="light"] .backup-status {
  color: #087a5c;
}
html[data-theme="light"] .backup-status.error {
  color: #c62f3f;
}
