@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

:root {
  --bg: #0b0f1f;
  --bg-soft: rgba(12, 16, 38, 0.85);
  --surface: rgba(18, 24, 52, 0.7);
  --surface-strong: rgba(20, 28, 60, 0.9);
  --text: #f5f7ff;
  --muted: rgba(245, 247, 255, 0.68);
  --accent: #7b7bff;
  --accent-2: #ffffff;
  --accent-3: #4dd1c4;
  --stroke: rgba(255, 255, 255, 0.12);
  --border-width: 1px;
  --border-gradient: linear-gradient(135deg, rgba(255, 255, 255, 0.248), rgba(255, 255, 255, 0.12) 50%, rgba(255, 255, 255, 0.248));
  --shadow: 0 24px 60px rgba(3, 8, 30, 0.45);
  --shadow-sm: 0 8px 16px rgba(3, 8, 30, 0.25);
  --shadow-lg: 0 32px 80px rgba(3, 8, 30, 0.6);
  --radius: 24px;
  --radius-pill: 9999px;
  --glass: blur(20px) saturate(140%);
  --grad-1: linear-gradient(135deg, rgba(123, 123, 255, 0.85), rgba(91, 242, 215, 0.8));
  --grad-2: linear-gradient(135deg, rgba(255, 143, 212, 0.85), rgba(123, 123, 255, 0.8));
  --grad-bg: linear-gradient(135deg, #0f0f2e 0%, #1a1a4d 50%, #0f1f3f 100%);
  --success: #5bf2d7;
  --error: #ff8fd4;
}

html[data-theme="dark"] {
  --bg: #0b0f1f;
  --bg-soft: rgba(12, 16, 38, 0.85);
  --surface: rgba(18, 24, 52, 0.7);
  --surface-strong: rgba(20, 28, 60, 0.9);
  --text: #f5f7ff;
  --muted: rgba(245, 247, 255, 0.68);
}

html[data-theme="light"] {
  --bg: #f4f6ff;
  --bg-soft: rgba(244, 246, 255, 0.95);
  --surface: rgba(255, 255, 255, 0.7);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --text: #0b0f1f;
  --muted: rgba(11, 15, 31, 0.6);
  --stroke: rgba(13, 17, 36, 0.12);
  --border-gradient: linear-gradient(135deg, rgba(11, 15, 31, 0.28), rgba(11, 15, 31, 0.08) 50%, rgba(11, 15, 31, 0.22));
  --shadow: 0 24px 60px rgba(65, 72, 120, 0.18);
  --shadow-sm: 0 8px 16px rgba(65, 72, 120, 0.12);
  --shadow-lg: 0 32px 80px rgba(65, 72, 120, 0.25);
  --grad-bg: linear-gradient(135deg, #f0f4ff 0%, #e8f0ff 50%, #f0f8ff 100%);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--grad-bg);
  color: var(--text);
  min-height: 100vh;
  padding: 20px;
}

html,
body {
  touch-action: manipulation;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -2;
  pointer-events: none;
}

body::before {
  background: radial-gradient(circle at 10% 20%, rgba(123, 123, 255, 0.15), transparent 50%),
              radial-gradient(circle at 90% 80%, rgba(91, 242, 215, 0.15), transparent 50%);
  filter: blur(40px);
}

body::after {
  background: radial-gradient(circle at 70% 10%, rgba(255, 143, 212, 0.1), transparent 55%),
              radial-gradient(circle at 85% 80%, rgba(91, 242, 215, 0.1), transparent 60%);
  filter: blur(60px);
}

html[data-theme="light"] body::before {
  background: radial-gradient(circle at 10% 20%, rgba(91, 91, 200, 0.08), transparent 50%),
              radial-gradient(circle at 90% 80%, rgba(91, 200, 180, 0.08), transparent 50%);
}

html[data-theme="light"] body::after {
  background: radial-gradient(circle at 70% 10%, rgba(200, 100, 160, 0.06), transparent 55%),
              radial-gradient(circle at 85% 80%, rgba(91, 180, 200, 0.06), transparent 60%);
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

:where(
  header,
  .result-container,
  .button-grid,
  .explanation,
  .faq-section,
  footer,
  .faq-item,
  .action-button,
  .tab,
  .header-menu,
  .side-menu-panel,
  .side-menu-button,
  .scroll-arrow,
  .result-overlay-glassy,
  .card-display,
  .popup-box,
  .popup-box button[type="submit"],
  #cancelPopup,
  #okPopup,
  .small.primary,
  .small.secondary
) {
  position: relative;
  border: 0 !important;
  isolation: isolate;
}

:where(
  header,
  .result-container,
  .button-grid,
  .explanation,
  .faq-section,
  footer,
  .faq-item,
  .action-button,
  .tab,
  .header-menu,
  .side-menu-panel,
  .side-menu-button,
  .scroll-arrow,
  .result-overlay-glassy,
  .card-display,
  .popup-box,
  .popup-box button[type="submit"],
  #cancelPopup,
  #okPopup,
  .small.primary,
  .small.secondary
)::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: var(--border-width);
  border-radius: inherit;
  background: var(--border-gradient);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* HEADER CARD */
header {
  background: var(--surface);
  border-radius: var(--radius);
  border: var(--border-width) solid transparent;
  backdrop-filter: var(--glass);
  padding: 20px 20px;
  margin-bottom: 30px;
  box-shadow: var(--shadow-sm);
}

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 6px 12px rgba(3, 8, 30, 0.35));
  transition: filter 0.35s ease;
}

.header-logo.success-glow {
  filter: drop-shadow(0 0 12px rgba(34, 139, 34, 0.9))
          drop-shadow(0 10px 20px rgba(34, 139, 34, 0.6));
}

.header-logo.error-glow {
  filter: drop-shadow(0 0 12px rgba(220, 20, 60, 0.9))
          drop-shadow(0 10px 20px rgba(220, 20, 60, 0.6)) !important;
}

h1 {
  font-size: 2.8rem;
  font-weight: 700;
  background: var(--grad-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0;
  text-align: left;
  user-select: none;
  -webkit-user-select: none;
}

.header-subtitle {
  font-size: 1.1rem;
  color: var(--muted);
  margin-top: 8px;
  margin-bottom: 0;
  text-align: center;
}

.header-subtitle:empty {
  display: none;
}

.header-menu {
  justify-self: end;
  width: 40px;
  height: 40px;
  aspect-ratio: 1 / 1;
  min-width: 40px;
  min-height: 40px;
  border-radius: 9999px;
  border: var(--border-width) solid transparent;
  background: rgba(179, 179, 179, 0.254);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.header-menu span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
  opacity: 0.85;
}

.header-menu:hover {
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
}

#current-selection {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--accent);
  min-height: 32px;
  position: relative;
  z-index: 40;
  user-select: none;
  -webkit-user-select: none;
}

/* RESULT CONTAINER CARD */
.result-container {
  background: var(--surface);
  border-radius: var(--radius);
  border: var(--border-width) solid transparent;
  backdrop-filter: var(--glass);
  padding: 18px;
  margin-bottom: 30px;
  height: 320px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  position: relative;
  overflow: visible;
  box-shadow: var(--shadow-sm);
  gap: 8px;
  padding-top: 20px;
  padding-bottom: 16px;
}

#result-display {
  position: relative;
  font-size: 1.9rem;
  font-weight: 600;
  word-wrap: break-word;
  width: 100%;
  z-index: 20;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 8px;
  height: 160px;
  min-height: 160px;
}

.result-container.compact-result #result-display {
  height: 48px;
  min-height: 48px;
}

#result-display.red-card,
#result-display.black-card {
  font-size: 4rem;
}

#result-display.lotto-result {
  font-size: clamp(1.4rem, 7vw, 2.8rem);
  white-space: nowrap;
}

#result-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 260px;
  z-index: 30;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  pointer-events: auto;
}

/* GLASSY EFFECT FOR RESULT OVERLAY */
.result-overlay-glassy {
  background: rgba(123, 123, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  border: var(--border-width) solid transparent;
  padding: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

#color-display {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  margin: 0 auto;
  border: none;
  box-shadow: none;
  backdrop-filter: blur(4px);
  position: relative;
}

#color-display::after {
  content: "";
  position: absolute;
  inset: 0;
  padding: 3px;
  border-radius: inherit;
  background: var(--border-gradient);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

#bottle-display {
  width: auto;
  height: 160px;
  transition: transform 3s cubic-bezier(0.25, 1, 0.5, 1);
  margin: -30px;
  display: block;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  pointer-events: none;
}

/* RANDOMIZER BUTTON - inside result container */
.rerun-btn {
  border-radius: var(--radius-pill) !important;
  padding: 10px 24px !important;
  font-size: 1.2rem !important;
  width: auto !important;
  margin-bottom: 12px !important;
  margin-top: 0 !important;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* SELECTION GRID - 3 COLUMNS x 4 ROWS */
.button-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  margin-bottom: 30px;
  padding: 30px;
  background: var(--surface);
  border-radius: var(--radius);
  border: var(--border-width) solid transparent;
  backdrop-filter: var(--glass);
  box-shadow: var(--shadow-sm);
}

.button-grid .action-button {
  flex: 1 1 calc(33.333% - 20px);
  min-width: max-content;
}

@media (max-width: 1000px) {
  .button-grid {
    gap: 12px;
  }
}

@media (max-width: 600px) {
  .button-grid {
    gap: 12px;
    padding: 20px;
  }
}

/* ACTION BUTTONS - PILL STYLE */
.action-button {
  background: rgba(179, 179, 179, 0.254);
  color: var(--text);
  border: var(--border-width) solid transparent;
  border-radius: var(--radius-pill);
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-sm);
  font-family: 'Plus Jakarta Sans', sans-serif;
  backdrop-filter: blur(10px);
}

.action-button:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.12);
}

.action-button:active {
  transform: translateY(-2px);
}

.action-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.action-button.active {
  background: rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow-sm);
  border-color: rgba(255, 255, 255, 0.55);
}

/* INPUT SECTION - part of result container */
.input-section {
  background: transparent;
  border-radius: 0;
  border: none;
  backdrop-filter: none;
  padding: 0;
  margin-bottom: 0;
  box-shadow: none;
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 0;
  position: relative;
  z-index: 40;
}

.input-section input,
.input-section textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.18);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 12px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  min-width: 90px;
  box-shadow: var(--shadow-sm);
}

.input-section input:focus,
.input-section textarea:focus {
  outline: none;
  background: rgba(123, 123, 255, 0.1);
  border-color: rgba(0, 0, 0, 0.28);
  box-shadow: 0 0 0 3px rgba(123, 123, 255, 0.2);
}

.input-section textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
}

/* EXPLANATION/INFO SECTION */
.explanation {
  background: var(--surface);
  border-radius: var(--radius);
  border: var(--border-width) solid transparent;
  backdrop-filter: var(--glass);
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: var(--shadow-sm);
  line-height: 1.7;
}

.explanation h2 {
  color: var(--accent);
  font-size: 1.4rem;
  margin-bottom: 20px;
}

.explanation p {
  color: var(--muted);
  margin-bottom: 12px;
}

.explanation ul {
  margin: 12px 0 0;
  padding-left: 1.25rem;
  list-style-position: outside;
}

.explanation li {
  margin: 6px 0;
  padding-left: 0.2rem;
}

/* TABS */
.tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab {
  background: rgba(255, 255, 255, 0.05);
  border: var(--border-width) solid transparent;
  border-radius: var(--radius-pill);
  padding: 8px 20px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
  transition: all 0.2s ease;
  font-family: 'Plus Jakarta Sans', sans-serif;
  backdrop-filter: blur(10px);
}

.tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tab.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.5);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* FAQ SECTION */
.faq-section {
  background: var(--surface);
  border-radius: var(--radius);
  border: var(--border-width) solid transparent;
  backdrop-filter: var(--glass);
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: var(--shadow-sm);
}

.faq-section h2 {
  color: var(--accent);
  font-size: 1.4rem;
  margin-bottom: 25px;
  text-align: center;
}

.faq-item {
  margin-bottom: 20px;
  padding: 18px;
  background: rgba(123, 123, 255, 0.08);
  border-radius: 12px;
  transition: all 0.2s ease;
  border: var(--border-width) solid transparent;
  cursor: pointer;
}

.faq-item:hover {
  background: rgba(123, 123, 255, 0.12);
  transform: translateX(4px);
}

.faq-item h3 {
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 0px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.faq-item h3::before {
  content: "▶";
  display: inline-block;
  transition: transform 0.3s ease;
  font-size: 0.8rem;
}

.faq-item.active h3::before {
  transform: rotate(90deg);
}

.faq-item p {
  color: var(--muted);
  font-size: 0.95rem;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
  opacity: 0;
  margin: 0;
}

.faq-item.active p {
  max-height: 500px;
  opacity: 1;
  margin-top: 0;
}

/* SCROLL ARROW POPUP */
.scroll-arrow {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(10px);
  opacity: 0;
  pointer-events: auto;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 9500;
  background: rgba(179, 179, 179, 0.18);
  border-radius: 9999px;
  padding: 10px 14px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.scroll-arrow img {
  width: 20px;
  height: 20px;
  display: block;
  transform: rotate(90deg);
}

html[data-theme="dark"] .scroll-arrow img {
  filter: invert(1);
}

.scroll-arrow.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* SIDE MENU */
.side-menu {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
}

.side-menu-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.06);
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(10px);
}

.side-menu-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 320px;
  max-width: 85vw;
  background: var(--surface);
  border-radius: 0 20px 20px 0;
  padding: 22px 20px;
  box-shadow: var(--shadow-lg);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}

.side-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.side-menu-header h2 {
  font-size: 1.2rem;
  margin: 0;
}

.side-menu-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 28px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.side-menu-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.side-menu-button {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.06);
  border: var(--border-width) solid transparent;
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.side-menu-button:hover {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

body.menu-open .side-menu {
  pointer-events: auto;
}

body.menu-open .side-menu-overlay {
  opacity: 1;
}

body.menu-open .side-menu-panel {
  transform: translateX(0);
}

/* FOOTER */
footer {
  background: var(--surface);
  border-radius: var(--radius);
  border: var(--border-width) solid transparent;
  backdrop-filter: var(--glass);
  padding: 30px;
  margin-top: 30px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

footer p {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 8px 0;
}

footer a,
footer .footer-link {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

footer a:hover,
footer .footer-link:hover {
  color: var(--accent-2);
}

/* DICE */
.dice-container {
  perspective: 600px;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 150px;
}

.dice {
  position: relative;
  transform-style: preserve-3d;
  transition: transform 1s cubic-bezier(.36, 2, .57, .5);
}

.face {
  position: absolute;
  width: 100px;
  height: 100px;
  background: #ffffff;
  border-style: solid;
  border-color: rgba(120, 120, 120, 0.6);
  border-width: 2px;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  box-shadow: none;
  backface-visibility: hidden;
  backdrop-filter: blur(10px);
}

.dot {
  width: 16px;
  height: 16px;
  background: #111111;
  border-radius: 50%;
  position: absolute;
  box-shadow: none;
}

.dot.center {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.dot.top-left {
  top: 20%;
  left: 20%;
}

.dot.top-right {
  top: 20%;
  right: 20%;
}

.dot.middle-left {
  top: 50%;
  left: 20%;
  transform: translateY(-50%);
}

.dot.middle-right {
  top: 50%;
  right: 20%;
  transform: translateY(-50%);
}

.dot.bottom-left {
  bottom: 20%;
  left: 20%;
}

.dot.bottom-right {
  bottom: 20%;
  right: 20%;
}

.face.one {
  transform: rotateY(0deg) translateZ(50px);
}

.face.two {
  transform: rotateY(180deg) translateZ(50px);
}

.face.three {
  transform: rotateY(90deg) translateZ(50px);
}

.face.four {
  transform: rotateY(-90deg) translateZ(50px);
}

.face.five {
  transform: rotateX(90deg) translateZ(50px);
}

.face.six {
  transform: rotateX(-90deg) translateZ(50px);
}

/* COIN */
.coin-container {
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1000px;
  height: 150px;
  width: 150px;
  margin: 0 auto;
}

.coin-outer {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.coin {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 1.2s cubic-bezier(.23, 1.5, .57, 1);
}

.coin-face {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  backface-visibility: hidden;
  background: transparent padding-box, var(--border-gradient) border-box;
  border: 3px solid transparent;
  box-shadow: none;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2rem;
  font-weight: bold;
  color: #fff;
  backdrop-filter: blur(4px);
}

.coin-heads {
  transform: rotateY(0deg);
}

.coin-tails {
  transform: rotateY(180deg);
}

.coin-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* CARDS DISPLAY */
.card-display {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 112.5px;
  height: 150px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: var(--border-width) solid transparent;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  margin: auto;
}

.card-image {
  height: 100%;
  width: auto;
  object-fit: cover;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  pointer-events: none;
}

.card-display.bounce-out {
  animation: bounceOut 0.1s ease forwards;
}

.card-display.bounce-in {
  animation: bounceIn 0.2s cubic-bezier(0.22, 1.4, 0.36, 1) forwards;
}

@keyframes bounceOut {
  from {
    transform: scale(1);
    opacity: 1;
  }
  to {
    transform: scale(0.95);
    opacity: 0.8;
  }
}

@keyframes bounceIn {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }
  60% {
    transform: scale(1.03);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* POPUPS */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
}

.popup-box {
  background: var(--surface-strong);
  color: var(--text);
  padding: 30px;
  border-radius: var(--radius);
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  border: var(--border-width) solid transparent;
  backdrop-filter: var(--glass);
  position: relative;
  max-height: 90dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.popup-box h2 {
  margin-top: 0;
  margin-bottom: 15px;
  color: var(--accent);
  font-size: 1.3rem;
}

.popup-box p {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 15px;
  line-height: 1.6;
}

.popup-box label {
  display: block;
  margin: 12px 0 6px;
  color: var(--text);
  font-weight: 500;
}

.popup-box input,
.popup-box textarea {
  width: 100%;
  padding: 10px;
  margin-bottom: 12px;
  border: var(--border-width) solid transparent;
  background: rgba(255, 255, 255, 0.12) padding-box, var(--border-gradient) border-box;
  border-radius: 12px;
  color: var(--text);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.95rem;
  backdrop-filter: blur(4px);
  box-sizing: border-box;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.popup-box input:focus,
.popup-box textarea:focus {
  outline: none;
  background: rgba(123, 123, 255, 0.1) padding-box, var(--border-gradient) border-box;
  box-shadow: 0 0 0 3px rgba(123, 123, 255, 0.2);
}

.popup-box button[type="submit"] {
  width: 100%;
  padding: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: var(--border-width) solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s ease;
  margin-top: 12px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  box-shadow: var(--shadow-sm);
}

.popup-box button[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.12);
}

.popup {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-strong) padding-box, var(--border-gradient) border-box;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 20px;
  z-index: 1000;
  text-align: center;
  width: 280px;
  color: var(--text);
  border: var(--border-width) solid transparent;
  backdrop-filter: var(--glass);
}

.popup-content input {
  width: 90%;
  padding: 8px 12px;
  border: var(--border-width) solid transparent;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05) padding-box, var(--border-gradient) border-box;
  color: var(--text);
  margin: 10px 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

#cancelPopup,
#okPopup {
  margin-left: 10px;
  margin-top: 15px;
  padding: 8px 18px;
  border: var(--border-width) solid transparent;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  color: var(--text);
  transition: all 0.2s ease;
  font-weight: 600;
  font-family: 'Plus Jakarta Sans', sans-serif;
  box-shadow: var(--shadow-sm);
}

#cancelPopup:hover,
#okPopup:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.12);
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  position: absolute;
  top: 15px;
  right: 15px;
  cursor: pointer;
  color: var(--text);
  transition: color 0.2s ease;
}

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

/* PRIVACY & FAQ BOXES */
.popup-box.privacy-box,
.popup-box.faq-box {
  max-width: 600px;
  font-size: 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.popup-box.privacy-box::before,
.popup-box.faq-box::before {
  content: none;
}

.privacy-actions,
.faq-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  justify-content: flex-end;
}

.small {
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: all 0.2s ease;
}

.small.primary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: var(--border-width) solid transparent;
  box-shadow: var(--shadow-sm);
}

.small.primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.12);
}

.small.secondary {
  background: transparent;
  border: var(--border-width) solid transparent;
  color: var(--text);
}

.small.secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* UTILITY CLASSES */
.hidden {
  display: none;
}

.blur {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
}

.toggle-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0;
  margin-bottom: 0;
  width: 100%;
  margin-top: 0;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(200px + 50px);
  z-index: 40;
  padding: 0 6px;
}

.result-container.form-layout .toggle-wrapper {
  position: relative;
  left: auto;
  right: auto;
  top: auto;
  margin-top: 6px;
}

.invisible-toggle {
  background: transparent;
  border: none;
  width: 6vw;
  height: 10vw;
  opacity: 0;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.status {
  margin-top: 10px;
  font-weight: bold;
  color: var(--success);
}

/* TAB CONTENT */
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* RESPONSIVE */
@media (max-width: 768px) {
  body {
    padding: 12px;
  }

  .container {
    max-width: 100%;
  }

  header {
    padding: 30px 20px;
  }

  h1 {
    font-size: 2rem;
  }

  .result-container {
    padding: 25px;
    min-height: 150px;
  }

  .button-grid {
    padding: 20px;
    gap: 12px;
  }

  .action-button {
    padding: 10px 16px;
    font-size: 0.9rem;
  }

  .explanation,
  .faq-section,
  .input-section,
  footer {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.6rem;
  }

  .button-grid {
    gap: 10px;
    padding: 15px;
  }

  .popup-box {
    width: 95%;
    padding: 20px;
  }

  .tabs {
    gap: 8px;
  }

  .tab {
    padding: 6px 14px;
    font-size: 0.85rem;
  }
}

@media (hover: none) and (pointer: coarse) {
  .action-button:hover,
  .header-menu:hover,
  .tab:hover,
  .faq-item:hover,
  .popup-box button[type="submit"]:hover,
  #cancelPopup:hover,
  #okPopup:hover,
  .small.primary:hover,
  .small.secondary:hover,
  .side-menu-button:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
    border-color: inherit;
    background: inherit;
    color: inherit;
  }

  footer a:hover,
  footer .footer-link:hover {
    color: inherit;
  }
}

/* RESULT DISPLAY CARD STYLING */
#resultDisplay {
  font-family: "Segoe UI Symbol", "DejaVu Sans", "Arial Unicode MS", sans-serif;
  font-size: 2rem;
}

.red-card {
  color: #ff6b6b;
}

.black-card {
  color: #e8e8e8;
}

/* ADDITIONAL HOVER/ACTIVE STATES */
.popup-box input::placeholder,
.popup-box textarea::placeholder {
  color: rgba(245, 247, 255, 0.4);
}
