/* Modern, mobile-first styling with a dark theme and smooth animations */
:root {
  --bg: #0b0b0d;
  --card: #141417;
  --muted: #a3a3ad;
  --text: #f7f7fb;
  --accent: #ef4444;
  --accent-2: #d32f2f;
  --success: #22c55e;
  --warning: #f59e0b;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  color: var(--text);
  background: radial-gradient(
      1200px 800px at 50% -20%,
      #1d1d22 0%,
      #16161b 45%,
      #0f0f14 65%,
      #0c0c10 80%,
      #0b0b0d 100%
    )
    fixed;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 20px);
}
/* Add very subtle noise to fight gradient banding */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="2" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23n)" opacity=".05"/></svg>');
  pointer-events: none;
  mix-blend-mode: overlay;
}
#app {
  height: 100dvh;
  width: 100%;
  display: grid;
  place-items: center;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 20px)) 16px;
}
.container {
  width: min(860px, 100%);
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
}
header,
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
/* Reduce extra space above and below the title banner inside the header */
header {
  margin-top: -18px;
  margin-bottom: -18px;
  padding: 6px 0;
}
header .title {
  width: 205px;
  height: 68px;
  background-image: url("images/title_banner.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center left;
  text-indent: -9999px;
  overflow: hidden;
  flex-shrink: 0;
}
button.icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #1d1d22;
  border: 1px solid #2a2a30;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  font-size: 20px;
  line-height: 1;
  text-align: center;
  padding: 0;
  margin: 0;
}
.card {
  background: linear-gradient(180deg, #18181c, #131318);
  border: 1px solid #22222a;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  height: 100%;
  overflow: hidden;
  padding: var(--card-py, 18px) 18px; 
}
.hstack {
  display: flex;
  align-items: center;
  gap: var(--h-gap, 12px);
}
.vstack {
  display: grid; gap: var(--v-gap, 14px);
}
.center {
  display: grid;
  place-items: center;
  height: 100%;
  text-align: center;
}

.card.compact {
  --v-gap: 0px;      /* engeres vertical stack spacing */
  --h-gap: 0px;     /* engeres horizontal spacing */
  --card-py: 6px;   /* weniger vertikales Card-Padding */
}

.card.compact #dealView .reveal-card { margin-block: 0px; }
.card.compact #dealView .hstack { margin-block-start: 6px; }
.card.compact #dealView .smallmuted { margin-block-start: 4px; }

.btn {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  outline: none;
  padding: 16px 20px;
  font-size: 18px;
  font-weight: 700;
  border-radius: calc(var(--radius) + 6px);
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.35);
  transform: translateY(0);
  transition: transform 0.15s ease, filter 0.2s ease, opacity 0.2s ease;
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.5;
  filter: grayscale(40%);
  pointer-events: none;
  box-shadow: none;
}
.btn.secondary {
  background: #1a1a1f;
  color: var(--text);
  box-shadow: none;
  border: 1px solid #2b2b33;
}
.btn.ghost {
  background: transparent;
  border: 1px solid #2b2b33;
}
.btn.block {
  width: 100%;
}
.btn.small {
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
}

.label {
  color: var(--muted);
  font-size: 14px;
}
.value {
  font-weight: 800;
  font-size: 22px;
}

.slider {
  width: 100%;
}
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 34px;
  background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  background: #272730;
  border-radius: 999px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  margin-top: -13px;
  width: 34px;
  height: 34px;
  background: white;
  border-radius: 50%;
  border: 6px solid var(--accent);
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.35);
}
.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, 1fr);
}
.grid.packs {
  gap: 8px;
  align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

@media (min-width: 880px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.tile {
  background: linear-gradient(180deg, #1c1c21, #141418);
  border: 1px solid #262630;
  border-radius: var(--radius);
  padding: 16px;
  height: 120px;
  display: grid;
  align-content: space-between;
  position: relative;
  transition: transform 0.25s ease, border-color 0.25s ease,
    box-shadow 0.25s ease;
  cursor: pointer;
}
.tile:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}
.tile.selected {
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
  transform: translateY(-2px);
}
.tile.locked {
  opacity: 0.5;
  position: relative;
}
.tile.locked::after {
  content: "🔒";
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 20px;
}

.tile.clickable {
  cursor: pointer;
}
.tile.clickable:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.kicker {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-size: min(28vw, 140px);
  font-weight: 900;
  letter-spacing: 1px;
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}

.reveal-card {
  position: relative;
  width: min(600px, 100%);
  height: min(480px, 60vh);
  background: linear-gradient(180deg, #121216, #0c0c10);
  border: 1px solid #23232b;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.reveal-sheet {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #5f3232, #7a2020);
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: center;
  justify-items: center;
  padding: 20px;
  color: #fff;
  font-weight: 800;
  touch-action: none;
  user-select: none;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-sheet .banner-image {
  background-image: url("images/card_banner.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  width: 100%;
  height: 90%;
  opacity: 0.9;
}
.reveal-sheet .pull-text {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  margin-top: 10px;
}
.reveal-under {
  position: absolute;
  inset: 0;
  display: grid;
  align-items: end;
  justify-items: center;
  padding: 28px;
  text-align: center;
}
.reveal-under h1 {
  font-size: 40px;
  margin: 0 0 8px 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
}
.reveal-under p {
  color: var(--muted);
  margin: 0;
  font-size: 18px;
}
.badge {
  display: inline-grid;
  place-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.badge.spy {
  background: rgba(239, 68, 68, 0.12);
  color: #ffb3b3;
  border-color: rgba(239, 68, 68, 0.35);
}
.badge.word {
  background: rgba(52, 211, 153, 0.12);
  color: #bdf6da;
  border-color: rgba(52, 211, 153, 0.32);
}

footer {
  gap: 10px;
}
footer .btn {
  flex: 1;
}
.hidden {
  display: none !important;
}
.smallmuted {
  font-size: 12px;
  color: var(--muted);
}

/* Switch styles */
.switch {
  position: relative;
  width: 56px;
  height: 32px;
  background: #2a2a34;
  border-radius: 999px;
  border: 1px solid #30303a;
}
.switch .dot {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 28px;
  height: 28px;
  background: white;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.switch.on .dot {
  transform: translateX(24px);
}

a.link {
  color: #9dd6ff;
  text-decoration: none;
  border-bottom: 1px dashed #9dd6ff33;
}

/* Firefox slider */
input[type="range"]::-moz-range-track {
  height: 8px;
  background: #272730;
  border: none;
  border-radius: 999px;
}
input[type="range"]::-moz-range-thumb {
  width: 28px;
  height: 28px;
  background: white;
  border: 6px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.35);
}
input[type="range"]::-moz-range-progress {
  height: 8px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px;
}
/* Edge/Firefox focus ring tweak */
input[type="range"]:focus {
  outline: none;
}

.tile .value {
  word-break: break-word;
  overflow-wrap: anywhere;
}
.grid::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.grid {
  scrollbar-gutter: stable;
}
/* Fix
 for mobile browser address bar covering buttons */
@supports (padding: max(0px)) {
  #app {
    padding-bottom: max(16px, env(safe-area-inset-bottom, 20px));
  }
}

/* Extra spacing for deal view buttons on mobile */
@media (max-height: 700px) {
  .reveal-card {
    height: min(400px, 45vh) !important;
  }
  .reveal-card + .hstack {
    margin-bottom: 20px !important;
  }

  /* Ensure footer is visible on small screens */
  .container {
    grid-template-rows: auto 1fr minmax(auto, 60px);
  }
}

/* For very small screens (iPhone SE, etc.) */
@media (max-height: 600px) {
  .reveal-card {
    height: min(350px, 40vh) !important;
  }

  .card {
    padding: 12px;
  }

  /* Make sure footer button is always visible */
  footer {
    min-height: 50px;
  }
}

/* Pack selector improvements */
.pack-selector .pack-header {
  border-bottom: 1px solid #2a2a34;
  margin-bottom: 16px;
  padding-bottom: 12px;
}

.pack-scroll-container {
  position: relative;
  overflow: hidden;
}

.pack-scroll-container .grid.packs {
  overflow-y: auto;
  max-height: 400px;
  padding-top: 8px;
  padding-bottom: 40px;
  scrollbar-width: thin;
  scrollbar-color: #3a3a46 transparent;
}

.pack-scroll-container .grid.packs::-webkit-scrollbar {
  width: 6px;
}

.pack-scroll-container .grid.packs::-webkit-scrollbar-track {
  background: transparent;
}

.pack-scroll-container .grid.packs::-webkit-scrollbar-thumb {
  background: #3a3a46;
  border-radius: 3px;
}

.pack-fade-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(
    transparent 0%,
    rgba(19, 19, 24, 0.8) 60%,
    #131318 100%
  );
  pointer-events: none;
  z-index: 2;
}

.tile.pack-tile {
  position: relative;
  height: auto;
  min-height: 100px;
  padding: 14px;
}

.tile.pack-tile .value {
  overflow-wrap: break-word;
  hyphens: auto;
  line-height: 1.2;
  font-size: 20px;
  white-space: normal;
}

.inline-warning {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent);
  font-size: 9px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  white-space: nowrap;
  z-index: 1;
}

/* Mobile adjustments for pack progress */
@media (max-width: 480px) {
  .inline-warning {
    font-size: 8px;
    padding: 1px 3px;
    top: 4px;
    right: 4px;
  }

  .tile.pack-tile .value {
    padding-right: 50px; /* Make space for progress indicator */
  }
}

.pack-preview {
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
