/* ========================================
   Base & Reset
   ======================================== */

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

html, body {
  height: 100%;
  overflow: hidden;
  background: #111;
  color: #e0e0e0;
  font-family: "Songti SC", "SimSun", "Noto Serif CJK SC", "PingFang SC", serif;
  -webkit-font-smoothing: antialiased;
}

/* heavy grain texture for hand-drawn feel */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

/* ========================================
   Screen System
   ======================================== */

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0s 0.5s;
  z-index: 1;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease, visibility 0s 0s;
  z-index: 10;
}

.screen-inner {
  width: 100%;
  max-width: 420px;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ========================================
   Screen 0: Red Star Splash
   ======================================== */

#screen-splash {
  background: #CC0000;
  cursor: pointer;
}

.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
}

.splash-star {
  width: 140px;
  height: 140px;
  filter: drop-shadow(0 4px 20px rgba(0,0,0,0.3));
  animation: starPulse 2.5s ease-in-out infinite;
}

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

.splash-year {
  font-family: "Courier New", "SF Mono", monospace;
  font-size: 20px;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 8px;
  font-weight: 700;
}

.splash-hint {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 6px;
  animation: blink 1.8s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.15; }
}

/* ========================================
   Screen 1: Generation Picker
   ======================================== */

#screen-gen {
  background: #111;
}

.gen-top-space {
  height: 18vh;
}

.gen-subtitle {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 2px;
  margin-bottom: 20px;
}

.gen-question {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 6px;
  color: #fff;
  margin-bottom: 48px;
}

.gen-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.gen-btn {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.6);
  font-size: 18px;
  font-family: inherit;
  padding: 14px 18px;
  border-radius: 2px 6px 4px 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 2px;
  min-width: 60px;
}

.gen-btn:hover,
.gen-btn:active {
  border-color: #CC0000;
  color: #fff;
  background: rgba(204, 0, 0, 0.15);
}

.gen-btn.selected {
  border-color: #CC0000;
  color: #fff;
  background: #CC0000;
  transform: rotate(-1deg) scale(1.05);
}

.gen-lock {
  margin-top: 28px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gen-lock-text {
  font-size: 14px;
  color: #CC0000;
  letter-spacing: 4px;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.gen-lock-text.visible {
  opacity: 1;
}

.gen-footer {
  position: fixed;
  bottom: max(24px, env(safe-area-inset-bottom, 24px));
  font-size: 12px;
  color: rgba(255, 255, 255, 0.12);
  letter-spacing: 3px;
}

/* ========================================
   Screen 2 & 3: Item Selection
   ======================================== */

#screen-past {
  background: #1a0808;
}

#screen-present {
  background: #111;
}

.screen-past-inner,
.screen-present-inner {
  height: 100vh;
  padding-top: max(56px, env(safe-area-inset-top, 56px));
  padding-bottom: max(24px, env(safe-area-inset-bottom, 24px));
  justify-content: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 20px;
  text-align: center;
  line-height: 1.6;
  flex-shrink: 0;
}

.past-title {
  color: #fff;
}

.present-title {
  color: rgba(255, 255, 255, 0.7);
}

.select-header {
  position: sticky;
  top: 0;
  z-index: 15;
  flex-shrink: 0;
  width: 100%;
  margin-bottom: 10px;
  border-radius: 2px 6px 3px 8px;
  border: 1px dashed rgba(255,255,255,0.1);
  overflow: hidden;
}

#screen-past .select-header {
  background: rgba(26, 8, 8, 0.95);
}

#screen-present .select-header {
  background: rgba(17, 17, 17, 0.95);
}

.select-counter {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
}

/* Selected items tray */
.selected-tray {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 10px;
}

.selected-tray.has-items {
  display: flex;
}

.tray-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 4px 10px;
  font-size: 12px;
  font-family: inherit;
  border: none;
  border-radius: 2px 4px 3px 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.3;
  max-width: 160px;
}

.tray-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tray-chip-x {
  font-size: 14px;
  opacity: 0.6;
  flex-shrink: 0;
  font-weight: 300;
}

/* Past tray chips */
.past-chip {
  background: rgba(204, 0, 0, 0.2);
  color: #fff;
}

.past-chip:hover,
.past-chip:active {
  background: rgba(204, 0, 0, 0.4);
}

/* Present tray chips */
.present-chip {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}

.present-chip:hover,
.present-chip:active {
  background: rgba(255, 255, 255, 0.2);
}

.counter-num {
  font-size: 22px;
  font-weight: 700;
  color: #CC0000;
  font-family: "Courier New", "SF Mono", monospace;
  min-width: 18px;
  text-align: right;
  transition: transform 0.15s ease;
}

.counter-num.bump {
  transform: scale(1.3);
}

.counter-sep {
  font-size: 16px;
  color: rgba(255,255,255,0.2);
  font-family: "Courier New", "SF Mono", monospace;
}

.counter-max {
  font-size: 16px;
  color: rgba(255,255,255,0.3);
  font-family: "Courier New", "SF Mono", monospace;
}

.counter-label {
  font-size: 12px;
  color: rgba(255,255,255,0.3);
  margin-left: 6px;
  letter-spacing: 1px;
}

.counter-full .counter-num {
  color: #fff;
}

.counter-full .counter-label {
  color: #CC0000;
}

.item-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  flex-shrink: 0;
  margin-bottom: 16px;
}

.grid-section-label {
  text-align: center;
  font-size: 13px;
  color: rgba(255,255,255,0.2);
  letter-spacing: 3px;
  padding: 12px 0 4px;
  grid-column: 1 / -1;
}

.item-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px dashed rgba(255, 255, 255, 0.1);
  border-radius: 2px 6px 3px 8px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
}

/* Past item card styles */
.item-card.past-card:hover,
.item-card.past-card:active {
  border-color: rgba(204, 0, 0, 0.4);
  background: rgba(204, 0, 0, 0.06);
}

.item-card.past-card.selected {
  border-style: solid;
  border-color: #CC0000;
  background: rgba(204, 0, 0, 0.15);
  transform: rotate(-0.3deg);
}

/* Present item card styles */
.item-card.present-card:hover,
.item-card.present-card:active {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.05);
}

.item-card.present-card.selected {
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.08);
  transform: rotate(0.3deg);
}

.item-name {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.past-card .item-name { color: #fff; }
.present-card .item-name { color: rgba(255, 255, 255, 0.8); }

.item-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
  line-height: 1.4;
}

/* Next button */
.next-btn {
  flex-shrink: 0;
  padding: 14px 48px;
  border: 2px solid transparent;
  border-radius: 2px 6px 3px 8px;
  font-size: 16px;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  position: sticky;
  bottom: max(16px, env(safe-area-inset-bottom, 16px));
  z-index: 20;
  margin-top: auto;
}

.next-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.next-btn:not(:disabled):hover,
.next-btn:not(:disabled):active {
  transform: scale(1.03) rotate(-0.5deg);
}

#past-next {
  box-shadow: 0 -20px 30px 10px #1a0808;
}

#past-next:not(:disabled) {
  background: #CC0000;
  color: #fff;
  border-color: #CC0000;
}

#present-next {
  box-shadow: 0 -20px 30px 10px #111;
}

#present-next:not(:disabled) {
  background: #fff;
  color: #111;
  border-color: #fff;
}

/* ========================================
   AI Loading indicator
   ======================================== */

.ai-loading {
  text-align: center;
  padding: 20px 0;
  display: none;
}

.ai-loading.active {
  display: block;
}

.loading-dots {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 1px;
}

.loading-dots span {
  animation: dotPulse 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 60%, 100% { opacity: 0.2; }
  30% { opacity: 1; }
}

/* ========================================
   Screen 4: Collision
   ======================================== */

#screen-collision {
  background: #111;
}

.collision-inner {
  justify-content: center;
  text-align: center;
}

.collision-stage {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  margin-bottom: 40px;
  position: relative;
  min-height: 60px;
}

.collision-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  opacity: 0;
}

.collision-left-col {
  text-align: right;
  color: #CC0000;
  transform: translateX(-60px);
  font-weight: 700;
}

.collision-right-col {
  text-align: left;
  color: rgba(255, 255, 255, 0.6);
  transform: translateX(60px);
}

.collision-col span {
  display: block;
  font-size: 18px;
  line-height: 1.5;
  letter-spacing: 1px;
}

.collision-slash {
  font-size: 28px;
  color: rgba(255, 255, 255, 0.15);
  opacity: 0;
  flex-shrink: 0;
  margin-top: 2px;
  font-weight: 300;
}

/* Collision animation states */
.collision-stage.animate .collision-left-col {
  animation: slideFromLeft 0.6s ease-out forwards;
}

.collision-stage.animate .collision-right-col {
  animation: slideFromRight 0.6s ease-out forwards;
}

.collision-stage.animate .collision-slash {
  animation: fadeIn 0.3s ease-out 0.5s forwards;
}

@keyframes slideFromLeft {
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideFromRight {
  to { transform: translateX(0); opacity: 1; }
}

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

.collision-flash {
  position: fixed;
  inset: 0;
  background: #CC0000;
  opacity: 0;
  pointer-events: none;
  z-index: 100;
}

.collision-flash.flash {
  animation: screenFlash 0.4s ease-out;
}

@keyframes screenFlash {
  0% { opacity: 0.6; }
  100% { opacity: 0; }
}

.collision-quote {
  font-family: "Songti SC", "SimSun", "Noto Serif CJK SC", serif;
  font-size: 18px;
  line-height: 1.9;
  color: rgba(255, 255, 255, 0.8);
  max-width: 320px;
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.8s ease;
  margin-bottom: 40px;
  border: none;
  padding: 0;
  quotes: none;
}

.collision-quote.visible {
  opacity: 1;
  transform: translateY(0);
}

.collision-next {
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px dashed rgba(255, 255, 255, 0.15);
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.3s ease, background 0.3s ease;
}

.collision-next.visible {
  opacity: 1;
}

.collision-next:disabled,
.collision-next:not(.visible) {
  pointer-events: none;
}

.collision-next:hover,
.collision-next:active {
  background: rgba(255, 255, 255, 0.12);
}

/* ========================================
   Screen 5: Soft Spot
   ======================================== */

#screen-soft {
  background: #111;
}

.soft-inner {
  height: 100vh;
  padding-top: max(56px, env(safe-area-inset-top, 56px));
  padding-bottom: max(24px, env(safe-area-inset-bottom, 24px));
  justify-content: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.soft-lead {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.3);
  margin-bottom: 12px;
  letter-spacing: 1px;
  text-align: center;
}

.soft-question {
  font-size: 21px;
  font-weight: 700;
  color: #CC0000;
  letter-spacing: 1px;
  text-align: center;
  margin-bottom: 28px;
  line-height: 1.5;
}

.soft-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-bottom: 14px;
}

.soft-option {
  background: rgba(204, 0, 0, 0.03);
  border: 1.5px dashed rgba(255, 255, 255, 0.1);
  border-radius: 2px 6px 3px 8px;
  padding: 13px 14px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 15px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.4;
}

.soft-option:hover,
.soft-option:active {
  border-color: rgba(204, 0, 0, 0.3);
  background: rgba(204, 0, 0, 0.06);
}

.soft-option.selected {
  border-style: solid;
  border-color: #CC0000;
  color: #fff;
  background: rgba(204, 0, 0, 0.12);
}

.soft-custom {
  width: 100%;
  margin-bottom: 20px;
}

.soft-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px dashed rgba(255, 255, 255, 0.1);
  border-radius: 2px 6px 3px 8px;
  padding: 13px 14px;
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.25s ease;
}

.soft-input::placeholder {
  color: rgba(255, 255, 255, 0.18);
}

.soft-input:focus {
  border-color: rgba(204, 0, 0, 0.4);
  border-style: solid;
}

#soft-next {
  box-shadow: 0 -20px 30px 10px #111;
}

#soft-next:not(:disabled) {
  background: #CC0000;
  color: #fff;
}

/* ========================================
   Screen 6: Retrieve One Thing
   ======================================== */

#screen-retrieve {
  background: #0A0A0F;
}

.retrieve-inner {
  height: 100vh;
  padding-top: max(56px, env(safe-area-inset-top, 56px));
  padding-bottom: max(24px, env(safe-area-inset-bottom, 24px));
  justify-content: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.retrieve-lead {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.3);
  margin-bottom: 12px;
  letter-spacing: 1px;
  text-align: center;
}

.retrieve-question {
  font-size: 21px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
  text-align: center;
  margin-bottom: 28px;
  line-height: 1.5;
}

.retrieve-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-bottom: 14px;
}

.retrieve-option {
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px dashed rgba(255, 255, 255, 0.1);
  border-radius: 2px 6px 3px 8px;
  padding: 13px 14px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 15px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.4;
}

.retrieve-option:hover,
.retrieve-option:active {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.05);
}

.retrieve-option.selected {
  border-style: solid;
  border-color: #fff;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.retrieve-custom {
  width: 100%;
  margin-bottom: 20px;
}

.retrieve-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px dashed rgba(255, 255, 255, 0.1);
  border-radius: 2px 6px 3px 8px;
  padding: 13px 14px;
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.25s ease;
}

.retrieve-input::placeholder {
  color: rgba(255, 255, 255, 0.18);
}

.retrieve-input:focus {
  border-color: rgba(255, 255, 255, 0.4);
  border-style: solid;
}

#retrieve-next {
  box-shadow: 0 -20px 30px 10px #0A0A0F;
}

#retrieve-next:not(:disabled) {
  background: #CC0000;
  color: #fff;
}

/* ========================================
   Screen 7: Poster
   ======================================== */

#screen-poster {
  background: #111;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  align-items: flex-start;
}

.poster-outer {
  padding-top: max(36px, env(safe-area-inset-top, 36px));
  padding-bottom: max(36px, env(safe-area-inset-bottom, 36px));
  min-height: 100%;
  justify-content: flex-start;
  margin: 0 auto;
}

.poster-card {
  width: 100%;
  max-width: 375px;
  background: #0e0e0e;
  border-radius: 0;
  overflow: hidden;
  border: 3px solid #CC0000;
  position: relative;
}

.poster-preview-card {
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(204, 0, 0, 0.12), rgba(10, 10, 10, 0.02) 16%),
    linear-gradient(180deg, #141111 0%, #0c0c0c 100%);
}

.poster-preview-top {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.poster-preview-kicker {
  font-size: 14px;
  font-weight: 800;
  color: #f1e6d1;
  letter-spacing: 1px;
}

.poster-preview-meta {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.6;
}

.poster-image-shell {
  position: relative;
  min-height: 520px;
  background:
    radial-gradient(circle at top, rgba(204, 0, 0, 0.18), transparent 28%),
    linear-gradient(180deg, #1b1513 0%, #0e0e0e 100%);
  border: 2px solid rgba(204, 0, 0, 0.5);
  overflow: hidden;
}

.poster-image-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.05), transparent 20%),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.02) 0,
      rgba(255, 255, 255, 0.02) 2px,
      transparent 2px,
      transparent 7px
    );
  z-index: 2;
}

.poster-image-loading,
.poster-image-error {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 28px;
  text-align: center;
  z-index: 3;
}

.poster-image-loading.active,
.poster-image-error.active {
  display: flex;
}

.poster-image-loading {
  background: rgba(14, 14, 14, 0.82);
}

.poster-image-error {
  background: rgba(28, 10, 10, 0.9);
}

.poster-loading-title,
.poster-error-title {
  font-size: 22px;
  font-weight: 800;
  color: #f2e6d0;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

.poster-loading-copy,
.poster-error-copy {
  font-size: 13px;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.65);
  max-width: 240px;
}

.poster-retry-btn {
  margin-top: 18px;
  width: auto;
  min-width: 190px;
}

.poster-final-image {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.poster-image-shell.is-ready .poster-final-image {
  opacity: 1;
}

/* Share actions */
.share-actions {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 375px;
}

.share-btn {
  width: 100%;
  padding: 14px;
  border: 2px solid transparent;
  border-radius: 2px 6px 3px 8px;
  font-size: 16px;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #CC0000;
  color: #fff;
}

.share-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.share-btn:hover,
.share-btn:active {
  transform: scale(1.02) rotate(-0.3deg);
}

.share-btn-secondary {
  background: transparent;
  border: 1.5px dashed rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.4);
}

.share-btn-secondary:hover,
.share-btn-secondary:active {
  border-color: rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.6);
}

.share-note {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.28);
  line-height: 1.6;
  text-align: center;
  padding: 0 8px;
}

.share-note.is-success {
  color: rgba(255, 255, 255, 0.72);
}

.share-note.is-error {
  color: #ff8a8a;
}

/* ========================================
   Screen 8: Voice Wall
   ======================================== */

#screen-wall {
  background: #0A0A0F;
}

.wall-inner {
  height: 100vh;
  padding-top: max(56px, env(safe-area-inset-top, 56px));
  padding-bottom: max(24px, env(safe-area-inset-bottom, 24px));
  justify-content: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.wall-lead {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 2px;
  margin-bottom: 12px;
}

.wall-title {
  font-size: 24px;
  color: #fff;
  letter-spacing: 2px;
  text-align: center;
  margin-bottom: 18px;
}

.wall-filters {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 18px;
}

.wall-filter {
  border: 1.5px dashed rgba(255, 255, 255, 0.14);
  background: transparent;
  color: rgba(255, 255, 255, 0.45);
  padding: 8px 12px;
  border-radius: 2px 6px 3px 8px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.wall-filter.selected,
.wall-filter:hover,
.wall-filter:active {
  color: #fff;
  border-style: solid;
  border-color: #CC0000;
  background: rgba(204, 0, 0, 0.12);
}

.wall-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.wall-card {
  width: 100%;
  padding: 14px;
  border: 1.5px dashed rgba(255, 255, 255, 0.12);
  border-radius: 2px 6px 3px 8px;
  background: rgba(255, 255, 255, 0.03);
}

.wall-card-top {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 10px;
}

.wall-card-gen {
  font-size: 12px;
  color: #CC0000;
  letter-spacing: 2px;
  font-family: "Courier New", "SF Mono", monospace;
}

.wall-card-quote {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.8;
  margin-bottom: 10px;
}

.wall-card-line {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.6;
}

.wall-back {
  box-shadow: 0 -20px 30px 10px #0A0A0F;
}

.wall-back:not(:disabled) {
  background: #CC0000;
  color: #fff;
}

/* ========================================
   Screen shake animation
   ======================================== */

.screen-shake {
  animation: shake 0.4s ease-out;
}

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

/* ========================================
   Responsive
   ======================================== */

@media (max-height: 600px) {
  .gen-top-space { height: 10vh; }
  .gen-question { font-size: 26px; margin-bottom: 32px; }
  .gen-btn { padding: 10px 14px; font-size: 16px; }
  .splash-star { width: 100px; height: 100px; }
}

@media (min-width: 500px) {
  .item-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}

/* ========================================
   Retro Rock Redesign
   ======================================== */

:root {
  --rock-red: #b80f0a;
  --rock-red-deep: #7f0906;
  --rock-black: #0b0908;
  --rock-paper: #d8c8ad;
  --rock-paper-dark: #b59f82;
  --rock-paper-light: #efe5d0;
  --rock-ink: #191513;
  --rock-gray: #8f8778;
  --rock-line: rgba(216, 200, 173, 0.18);
  --rock-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
}

html, body {
  background:
    radial-gradient(circle at top, rgba(184, 15, 10, 0.22), transparent 34%),
    linear-gradient(180deg, #140d0c 0%, #090909 46%, #080808 100%);
  color: var(--rock-paper-light);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(115deg, transparent 0 28%, rgba(255, 255, 255, 0.02) 28% 30%, transparent 30% 100%),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.015) 0 2px, transparent 2px 6px);
  pointer-events: none;
  z-index: 0;
}

body::after {
  opacity: 0.09;
  mix-blend-mode: soft-light;
}

.screen {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.01), rgba(0, 0, 0, 0.18)),
    transparent;
}

.screen::before {
  content: "";
  position: absolute;
  inset: 18px 14px;
  border: 1px solid rgba(255, 245, 220, 0.06);
  pointer-events: none;
  z-index: 0;
}

.screen-inner {
  position: relative;
  z-index: 1;
}

#screen-splash {
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.06), transparent 42%),
    linear-gradient(180deg, #b3120d 0%, #8a0b07 100%);
}

#screen-splash::before {
  inset: 12px;
  border: 2px solid rgba(255, 255, 255, 0.14);
}

.splash-inner {
  gap: 22px;
  transform: rotate(-1.2deg);
}

.splash-star {
  width: 168px;
  height: 168px;
  filter:
    drop-shadow(0 10px 24px rgba(0, 0, 0, 0.42))
    drop-shadow(0 0 0 rgba(255, 255, 255, 0.22));
}

.splash-year {
  font-size: 18px;
  letter-spacing: 10px;
  color: rgba(255, 248, 235, 0.88);
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
}

.splash-hint {
  color: rgba(255, 245, 220, 0.58);
  letter-spacing: 8px;
  font-size: 12px;
  text-transform: uppercase;
}

#screen-gen {
  background:
    radial-gradient(circle at 50% 18%, rgba(184, 15, 10, 0.18), transparent 24%),
    linear-gradient(180deg, #11100f 0%, #0a0909 100%);
}

.gen-subtitle {
  color: rgba(216, 200, 173, 0.52);
  letter-spacing: 4px;
  text-transform: uppercase;
}

.gen-question {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 8px;
  line-height: 1.2;
  color: var(--rock-paper-light);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.32);
  position: relative;
}

.gen-question::after {
  content: "";
  display: block;
  width: 128px;
  height: 4px;
  margin: 14px auto 0;
  background: linear-gradient(90deg, transparent, var(--rock-red), transparent);
  transform: rotate(-1.5deg);
}

.gen-buttons {
  gap: 12px;
}

.gen-btn {
  min-width: 84px;
  background: linear-gradient(180deg, rgba(239, 229, 208, 0.1), rgba(216, 200, 173, 0.04));
  border: 1px solid rgba(216, 200, 173, 0.22);
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.22);
  color: rgba(239, 229, 208, 0.74);
  font-weight: 700;
}

.gen-btn:nth-child(odd) {
  transform: rotate(-1deg);
}

.gen-btn:nth-child(even) {
  transform: rotate(1deg);
}

.gen-btn.selected {
  background: var(--rock-red);
  color: #fff7ea;
  box-shadow: 0 12px 26px rgba(88, 6, 4, 0.42);
  transform: rotate(-2deg) scale(1.03);
}

.gen-lock-text {
  color: var(--rock-paper);
}

.gen-footer {
  color: rgba(216, 200, 173, 0.22);
  letter-spacing: 5px;
}

#screen-past,
#screen-present,
#screen-soft,
#screen-retrieve,
#screen-wall {
  background:
    radial-gradient(circle at top, rgba(184, 15, 10, 0.08), transparent 28%),
    linear-gradient(180deg, #12100f 0%, #0a0909 100%);
}

.section-title,
.soft-question,
.retrieve-question,
.wall-title {
  font-weight: 900;
  letter-spacing: 3px;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.35);
}

.section-title {
  font-size: 24px;
  margin-bottom: 18px;
}

.past-title,
.present-title,
.retrieve-question,
.wall-title {
  color: var(--rock-paper-light);
}

.soft-question {
  color: var(--rock-paper-light);
}

.soft-lead,
.retrieve-lead,
.wall-lead {
  color: rgba(216, 200, 173, 0.46);
  letter-spacing: 3px;
}

.select-header {
  background:
    linear-gradient(180deg, rgba(216, 200, 173, 0.09), rgba(216, 200, 173, 0.04));
  border: 1px solid rgba(216, 200, 173, 0.16);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(8px);
}

.select-header::before {
  content: "SELECTION";
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 10px;
  color: rgba(216, 200, 173, 0.14);
  letter-spacing: 3px;
  font-family: "Courier New", "SF Mono", monospace;
}

.counter-num {
  color: var(--rock-paper-light);
}

.counter-full .counter-num {
  color: #fff;
}

.counter-label,
.counter-max,
.counter-sep {
  color: rgba(216, 200, 173, 0.44);
}

.selected-tray {
  padding-bottom: 12px;
}

.tray-chip {
  border: 1px solid rgba(216, 200, 173, 0.18);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.past-chip,
.present-chip {
  background: linear-gradient(180deg, rgba(216, 200, 173, 0.16), rgba(216, 200, 173, 0.08));
  color: var(--rock-paper-light);
}

.past-chip:hover,
.past-chip:active,
.present-chip:hover,
.present-chip:active {
  background: linear-gradient(180deg, rgba(184, 15, 10, 0.36), rgba(121, 10, 7, 0.4));
}

.item-grid {
  gap: 12px;
}

.grid-section-label {
  color: rgba(216, 200, 173, 0.34);
  letter-spacing: 6px;
  padding-top: 18px;
}

.item-card,
.soft-option,
.retrieve-option,
.wall-card {
  background:
    linear-gradient(180deg, rgba(216, 200, 173, 0.1), rgba(216, 200, 173, 0.05));
  border: 1px solid rgba(216, 200, 173, 0.18);
  box-shadow: var(--rock-shadow);
  position: relative;
  overflow: hidden;
}

.item-card::before,
.soft-option::before,
.retrieve-option::before,
.wall-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.03), transparent 26%),
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.025) 0 2px, transparent 2px 6px);
  pointer-events: none;
}

.item-card:nth-child(3n + 1),
.soft-option:nth-child(odd),
.retrieve-option:nth-child(odd),
.wall-card:nth-child(odd) {
  transform: rotate(-0.55deg);
}

.item-card:nth-child(3n + 2),
.soft-option:nth-child(even),
.retrieve-option:nth-child(even),
.wall-card:nth-child(even) {
  transform: rotate(0.45deg);
}

.item-card:hover,
.item-card:active,
.soft-option:hover,
.soft-option:active,
.retrieve-option:hover,
.retrieve-option:active {
  transform: translateY(-2px) rotate(-0.3deg);
  border-color: rgba(216, 200, 173, 0.42);
}

.item-card.past-card.selected,
.soft-option.selected {
  background:
    linear-gradient(180deg, rgba(184, 15, 10, 0.44), rgba(127, 9, 6, 0.38));
  border-color: rgba(255, 235, 214, 0.5);
}

.item-card.present-card.selected,
.retrieve-option.selected {
  background:
    linear-gradient(180deg, rgba(216, 200, 173, 0.26), rgba(181, 159, 130, 0.14));
  border-color: rgba(216, 200, 173, 0.5);
}

.item-name {
  color: var(--rock-paper-light);
  font-size: 17px;
  letter-spacing: 1px;
}

.item-desc {
  color: rgba(216, 200, 173, 0.52);
}

.next-btn,
.share-btn,
.wall-filter {
  position: relative;
  overflow: hidden;
}

.next-btn::before,
.share-btn::before,
.wall-filter::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0 30%, rgba(255, 255, 255, 0.08) 30% 38%, transparent 38% 100%);
  pointer-events: none;
}

.next-btn {
  border: 1px solid rgba(216, 200, 173, 0.22);
  background: linear-gradient(180deg, rgba(216, 200, 173, 0.12), rgba(216, 200, 173, 0.04));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.3);
  color: var(--rock-paper-light);
}

.next-btn:not(:disabled) {
  background: linear-gradient(180deg, var(--rock-red), var(--rock-red-deep));
  border-color: rgba(255, 240, 220, 0.24);
}

.ai-loading {
  background: rgba(216, 200, 173, 0.05);
  border: 1px dashed rgba(216, 200, 173, 0.18);
  border-radius: 4px 10px 6px 12px;
  padding: 18px 16px;
  width: 100%;
  margin-bottom: 14px;
}

.loading-dots {
  color: rgba(216, 200, 173, 0.62);
  letter-spacing: 2px;
}

#screen-collision {
  background:
    radial-gradient(circle at center, rgba(184, 15, 10, 0.2), transparent 32%),
    linear-gradient(180deg, #0e0d0c 0%, #050505 100%);
}

.collision-stage {
  padding: 26px 18px;
  width: 100%;
  max-width: 360px;
  background:
    linear-gradient(180deg, rgba(216, 200, 173, 0.06), rgba(216, 200, 173, 0.02));
  border: 1px solid rgba(216, 200, 173, 0.16);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.42);
}

.collision-col span {
  font-size: 20px;
  line-height: 1.45;
  letter-spacing: 2px;
}

.collision-left-col {
  color: var(--rock-paper-light);
}

.collision-right-col {
  color: rgba(216, 200, 173, 0.5);
}

.collision-slash {
  color: var(--rock-red);
  font-size: 44px;
  text-shadow: 0 0 20px rgba(184, 15, 10, 0.34);
}

.collision-quote {
  max-width: 342px;
  color: var(--rock-paper-light);
  font-size: 21px;
  line-height: 1.8;
  letter-spacing: 1px;
  margin-top: 26px;
  margin-bottom: 34px;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.35);
}

.collision-quote::before,
.collision-quote::after {
  content: "";
  display: block;
  width: 74px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(216, 200, 173, 0.56), transparent);
  margin: 0 auto 14px;
}

.collision-quote::after {
  margin: 14px auto 0;
}

#screen-poster {
  background:
    radial-gradient(circle at top, rgba(184, 15, 10, 0.2), transparent 26%),
    linear-gradient(180deg, #0f0c0b 0%, #090909 100%);
}

.poster-card {
  background:
    linear-gradient(180deg, rgba(239, 229, 208, 0.97), rgba(216, 200, 173, 0.94));
  border: 12px solid #16110f;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
}

.poster-card::before,
.poster-card::after {
  content: "";
  position: absolute;
  width: 96px;
  height: 26px;
  background: rgba(27, 21, 18, 0.42);
  top: 14px;
  z-index: 4;
}

.poster-card::before {
  left: 24px;
  transform: rotate(-7deg);
}

.poster-card::after {
  right: 20px;
  transform: rotate(8deg);
}

.poster-watermark {
  color: rgba(184, 15, 10, 0.08);
  font-size: 114px;
  letter-spacing: 18px;
  top: 47%;
}

.share-actions {
  gap: 12px;
  margin-top: 24px;
}

.share-btn {
  background: linear-gradient(180deg, #1f1815, #110d0b);
  border: 1px solid rgba(216, 200, 173, 0.2);
  color: var(--rock-paper-light);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.26);
}

.share-btn-primary,
.share-btn:first-child {
  background: linear-gradient(180deg, var(--rock-red), var(--rock-red-deep));
}

.share-btn-secondary {
  color: rgba(239, 229, 208, 0.74);
  border-color: rgba(216, 200, 173, 0.18);
}

.share-note {
  color: rgba(216, 200, 173, 0.54);
}

.wall-card {
  background:
    linear-gradient(180deg, rgba(216, 200, 173, 0.12), rgba(216, 200, 173, 0.06));
}

.wall-card-quote {
  color: var(--rock-paper-light);
  font-size: 16px;
}

.wall-card-line {
  color: rgba(216, 200, 173, 0.58);
}

@media (max-width: 420px) {
  .poster-title {
    font-size: 28px;
    letter-spacing: 7px;
  }

  .poster-watermark {
    font-size: 90px;
    letter-spacing: 12px;
  }

  .collision-quote {
    font-size: 19px;
  }
}
