/* ===================================================================
   IRCTC RAGE SIMULATOR — style.css
   Deliberately retro, cramped, slightly-ugly government-website vibe.
   =================================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --irctc-blue: #213a8f;
  --irctc-blue-dark: #16266a;
  --irctc-orange: #f47216;
  --irctc-orange-dark: #d85f08;
  --sky: #e8f0fb;
  --panel-border: #b9c6e6;
  --danger: #d0021b;
  --ok: #1f8a37;
  --ink: #1c2333;
}

body {
  font-family: Verdana, Tahoma, "Segoe UI", Arial, sans-serif;
  background:
    repeating-linear-gradient(0deg, #dfeaf9 0 2px, #e8f0fb 2px 24px),
    var(--sky);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
  min-height: 100vh;
  padding-bottom: 90px; /* room for rage meter */
  overflow-x: hidden;
}

/* ============ GOV HEADER ============ */
.gov-header {
  background: #fff;
  border-bottom: 3px solid var(--irctc-orange);
  box-shadow: 0 2px 5px rgba(0,0,0,.15);
}
.gov-top-strip {
  background: var(--irctc-blue-dark);
  color: #cdd8f5;
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  padding: 3px 10px;
  letter-spacing: .3px;
}
.gov-lang { font-weight: bold; }
.gov-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}
.gov-logo, .gov-emblem { font-size: 34px; line-height: 1; }
.gov-emblem { margin-left: auto; }
.gov-title h1 {
  font-size: 20px;
  color: var(--irctc-blue);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
}
.gov-title h1 span { color: var(--irctc-orange); }
.gov-title p {
  font-size: 10px;
  color: #555;
  margin-top: 2px;
}
.gov-nav {
  display: flex;
  background: var(--irctc-blue);
  overflow-x: auto;
}
.gov-nav a {
  color: #dde5fb;
  font-size: 11px;
  font-weight: bold;
  padding: 7px 12px;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,.15);
  cursor: pointer;
  user-select: none;
}
.gov-nav a.active, .gov-nav a:hover { background: var(--irctc-orange); color: #fff; }

/* ============ MARQUEE ============ */
.marquee-bar {
  background: #fff3cd;
  border-bottom: 1px solid #e0c97a;
  overflow: hidden;
  white-space: nowrap;
}
.marquee {
  display: inline-block;
  padding: 5px 0;
  font-size: 12px;
  color: #7a5c00;
  font-weight: bold;
  animation: scroll-left 22s linear infinite;
}
@keyframes scroll-left {
  from { transform: translateX(100vw); }
  to { transform: translateX(-100%); }
}

/* ============ LAYOUT ============ */
.wrap {
  max-width: 460px;
  margin: 14px auto;
  padding: 0 10px;
}
.screen { display: none; }
.screen.active { display: block; animation: fadeUp .25s ease; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ PANELS ============ */
.panel {
  background: #fff;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
  overflow: hidden;
}
.panel-head {
  background: linear-gradient(#3a56ba, var(--irctc-blue));
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  padding: 8px 10px;
  border-bottom: 2px solid var(--irctc-orange);
}
.panel-body { padding: 12px 10px; }

/* ============ FORM ============ */
.field {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.field label {
  flex: 0 0 92px;
  font-size: 12px;
  font-weight: bold;
  color: var(--irctc-blue-dark);
  text-align: right;
}
.input-wrap { flex: 1; }
.input-wrap input,
.input-wrap select {
  width: 100%;
  padding: 6px 6px;
  font-size: 13px;
  border: 1px solid #9fb0d6;
  border-radius: 2px;
  background: #f7faff;
  font-family: inherit;
  color: var(--ink);
}
.input-wrap input:focus, .input-wrap select:focus { outline: 2px solid var(--irctc-orange); }
.input-wrap select:disabled { background: #ececec; color: #444; font-weight: bold; }

.quota-note {
  background: #fff3cd;
  border: 1px dashed var(--irctc-orange);
  color: #7a5c00;
  font-size: 11px;
  padding: 5px 7px;
  border-radius: 3px;
  margin: 4px 0 10px;
  font-weight: bold;
}

/* ============ COUNTDOWN ============ */
.countdown-box {
  text-align: center;
  background: var(--irctc-blue-dark);
  color: #fff;
  border-radius: 4px;
  padding: 10px;
  margin-bottom: 12px;
}
#countdown-label { font-size: 12px; color: #b9c8f2; }
#countdown-num {
  font-size: 52px;
  font-weight: bold;
  font-family: "Courier New", monospace;
  color: var(--irctc-orange);
  line-height: 1.1;
  animation: pulse .9s ease-in-out infinite;
}
#countdown-num.go {
  color: #4dff88;
  font-size: 30px;
  animation: none;
}
.countdown-sub { font-size: 11px; color: #9fb0e6; }
@keyframes pulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}

/* ============ BIG BUTTON ============ */
.big-btn {
  display: block;
  width: 100%;
  padding: 13px;
  font-size: 16px;
  font-weight: bold;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(var(--irctc-orange), var(--irctc-orange-dark));
  border: none;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 3px 0 #9c4405;
  letter-spacing: .5px;
  transition: transform .05s ease;
}
.big-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #9c4405; }
.big-btn.disabled {
  background: #a9a9a9;
  box-shadow: 0 3px 0 #7d7d7d;
  cursor: not-allowed;
  color: #eee;
}
.big-btn.ready {
  animation: readyGlow .5s ease-in-out infinite alternate;
}
@keyframes readyGlow {
  from { box-shadow: 0 3px 0 #9c4405, 0 0 0 rgba(244,114,22,.6); }
  to { box-shadow: 0 3px 0 #9c4405, 0 0 18px rgba(244,114,22,.9); }
}
.btn-lock { margin-right: 4px; }
.tiny-print {
  text-align: center;
  font-size: 10px;
  color: #888;
  margin-top: 6px;
  font-style: italic;
}

/* ============ OBSTACLE COMMON ============ */
.obstacle-panel .panel-body { min-height: 240px; }
.ob-msg { font-size: 13px; margin-bottom: 12px; }
.ob-icon { font-size: 46px; text-align: center; display: block; margin: 6px 0; }
.ob-title {
  font-size: 17px; font-weight: bold; text-align: center;
  margin-bottom: 6px;
}
.ob-sub { font-size: 12px; text-align: center; color: #555; margin-bottom: 14px; }
.err-red { color: var(--danger); }

/* CAPTCHA */
.captcha-box {
  background: repeating-linear-gradient(45deg,#eee,#eee 6px,#e2e2e2 6px,#e2e2e2 12px);
  border: 1px solid #999;
  border-radius: 3px;
  text-align: center;
  padding: 12px;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
}
.captcha-text {
  font-family: "Comic Sans MS", cursive, monospace;
  font-size: 30px;
  font-weight: bold;
  letter-spacing: 3px;
  display: inline-block;
  color: #333;
  user-select: none;
  filter: blur(.4px);
}
.captcha-text span { display: inline-block; }
.captcha-strike { position: absolute; inset: 0; }
.captcha-strike::before, .captcha-strike::after {
  content: ""; position: absolute; left: 0; right: 0; height: 1px;
  background: rgba(0,0,0,.4);
}
.captcha-strike::before { top: 40%; transform: rotate(-4deg); }
.captcha-strike::after { top: 60%; transform: rotate(3deg); }

/* PAYMENT */
.pay-row {
  display: flex; justify-content: space-between;
  border-bottom: 1px dotted #ccc; padding: 5px 2px; font-size: 12px;
}
.pay-row.total { font-weight: bold; border-bottom: none; color: var(--irctc-blue-dark); }
.pay-methods { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.pay-methods button {
  flex: 1 1 40%;
  padding: 8px; font-size: 12px; font-weight: bold;
  border: 1px solid #9fb0d6; background: #f7faff; border-radius: 3px; cursor: pointer;
  font-family: inherit;
}
.pay-methods button:active { background: #ffe9d6; }

/* SPINNER */
.spinner {
  width: 54px; height: 54px; margin: 18px auto;
  border: 6px solid #d5def3;
  border-top-color: var(--irctc-orange);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.ob-input {
  width: 100%; padding: 8px; font-size: 15px; text-align: center;
  border: 1px solid #9fb0d6; border-radius: 3px; margin-bottom: 10px;
  font-family: inherit;
}
.step-count {
  text-align: center; font-size: 11px; color: #888; margin-top: 8px;
}

/* ============ RESULT ============ */
.result-body { text-align: center; }

/* SOLD OUT reveal — the gut-punch after the whole gauntlet */
.soldout-reveal {
  text-align: center;
  margin-bottom: 12px;
}
.soldout-stamp {
  display: inline-block;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 30px;
  letter-spacing: 2px;
  color: var(--danger);
  border: 4px solid var(--danger);
  border-radius: 6px;
  padding: 4px 16px;
  transform: rotate(-6deg) scale(0);
  opacity: 0;
}
.soldout-caption {
  font-size: 12px;
  color: #888;
  margin-top: 6px;
  opacity: 0;
}
.soldout-reveal.play .soldout-stamp {
  animation: stampDrop .35s cubic-bezier(.2,1.6,.4,1) forwards;
}
.soldout-reveal.play .soldout-caption {
  animation: fadeIn .3s ease .35s forwards;
}
@keyframes fadeIn { to { opacity: 1; } }
@keyframes stampDrop {
  0% { transform: rotate(-6deg) scale(2.4); opacity: 0; }
  70% { transform: rotate(-6deg) scale(.9); opacity: 1; }
  100% { transform: rotate(-6deg) scale(1); opacity: 1; }
}

.waitlist-badge {
  display: flex; flex-direction: column; gap: 2px;
  background: #fff3f3;
  border: 2px solid var(--danger);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 14px;
}
.wl-label { font-size: 11px; color: #b00; letter-spacing: 1px; }
.wl-value {
  font-size: 30px; font-weight: bold; color: var(--danger);
  font-family: "Courier New", monospace;
  animation: shake .4s ease;
}
.wl-sub { font-size: 11px; color: #888; }

.train-scene {
  position: relative;
  height: 78px;
  margin: 6px 0 14px;
  overflow: hidden;
}
.rails {
  position: absolute; bottom: 10px; left: 0; right: 0; height: 4px;
  background: repeating-linear-gradient(90deg,#888 0 10px,#bbb 10px 20px);
}
.chugging-train {
  position: absolute; bottom: 14px; left: -60px;
  font-size: 34px;
  animation: chug 3.2s linear infinite;
}
@keyframes chug {
  0% { left: -60px; }
  100% { left: 110%; }
}
.you-left-behind {
  position: absolute; bottom: 16px; left: 8px; font-size: 26px;
  animation: bobbing 1s ease-in-out infinite;
}
.you-left-behind span {
  font-size: 10px; color: #666; display: block; text-align: center; margin-top: -4px;
}
@keyframes bobbing {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
.result-quote {
  font-size: 14px; font-weight: bold; color: var(--irctc-blue-dark);
  background: #eef3fd; border-radius: 4px; padding: 10px; margin-bottom: 14px;
}
.result-actions { display: flex; flex-direction: column; gap: 8px; }
.share-btn { background: linear-gradient(#3a9c4b,#1f8a37); box-shadow: 0 3px 0 #14631f; }
.retry-btn { background: linear-gradient(#3a56ba, var(--irctc-blue)); box-shadow: 0 3px 0 #16266a; }

/* ============ RAGE METER ============ */
.rage-meter {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,.97);
  border-top: 2px solid var(--danger);
  padding: 6px 12px 10px;
  z-index: 40;
  box-shadow: 0 -2px 6px rgba(0,0,0,.12);
}
.rage-label {
  display: flex; justify-content: space-between;
  font-size: 12px; font-weight: bold; color: var(--danger);
  margin-bottom: 4px;
}
.rage-track {
  height: 14px; background: #eee; border-radius: 8px; overflow: hidden;
  border: 1px solid #ccc;
}
.rage-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg,#f5d020,#f47216 55%,#d0021b);
  transition: width .5s ease;
}
.rage-fill.max { animation: ragePulse .4s ease-in-out infinite; }
@keyframes ragePulse { 0%,100%{opacity:1;} 50%{opacity:.6;} }

/* ============ FLASH POPUP ============ */
.flash-overlay {
  position: fixed; inset: 0;
  background: rgba(120,0,0,.55);
  display: none;
  align-items: center; justify-content: center;
  z-index: 80;
}
.flash-overlay.show { display: flex; animation: flashIn .12s ease; }
.flash-card {
  background: var(--danger);
  color: #fff;
  border: 6px solid #fff;
  border-radius: 8px;
  padding: 26px 30px;
  text-align: center;
  transform: rotate(-3deg);
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  animation: stampSlam .25s cubic-bezier(.2,1.6,.4,1);
}
/* hopeful (green) variant — the fake "you almost got it" beat */
.flash-card.hope { background: var(--ok); transform: rotate(2deg); }
.flash-card.hope { animation: stampSlamHope .25s cubic-bezier(.2,1.6,.4,1); }
@keyframes stampSlamHope {
  0% { transform: rotate(2deg) scale(2.4); opacity: 0; }
  70% { transform: rotate(2deg) scale(.9); opacity: 1; }
  100% { transform: rotate(2deg) scale(1); }
}
.flash-title {
  font-size: 44px; font-weight: bold; letter-spacing: 2px;
  font-family: Impact, "Arial Black", sans-serif;
}
.flash-sub { font-size: 14px; margin-top: 6px; }
@keyframes flashIn { from{opacity:0;} to{opacity:1;} }
@keyframes stampSlam {
  0% { transform: rotate(-3deg) scale(2.4); opacity: 0; }
  70% { transform: rotate(-3deg) scale(.9); opacity: 1; }
  100% { transform: rotate(-3deg) scale(1); }
}

/* ============ SHARE MODAL ============ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  display: none;
  align-items: center; justify-content: center;
  z-index: 90; padding: 14px;
}
.modal-overlay.show { display: flex; animation: flashIn .15s ease; }
.share-card-wrap { width: 100%; max-width: 360px; }
.share-card {
  background: linear-gradient(160deg,#213a8f,#16266a);
  color: #fff;
  border: 3px solid var(--irctc-orange);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
}
.sc-header {
  background: var(--irctc-orange); color: #fff;
  font-weight: bold; text-align: center; padding: 8px; font-size: 15px;
  letter-spacing: 1px;
}
.sc-body { padding: 16px; text-align: center; position: relative; }
.sc-stamp {
  display: inline-block;
  border: 4px solid var(--danger); color: var(--danger);
  background: rgba(255,255,255,.9);
  font-weight: bold; font-size: 26px; font-family: Impact, sans-serif;
  padding: 4px 14px; border-radius: 6px; transform: rotate(-8deg);
  margin-bottom: 10px;
}
.sc-line { font-size: 15px; font-weight: bold; margin-bottom: 12px; }
.sc-stats { display: flex; justify-content: space-around; margin-bottom: 12px; }
.sc-stats div { display: flex; flex-direction: column; }
.sc-stats span { font-size: 18px; font-weight: bold; color: var(--irctc-orange); }
.sc-stats small { font-size: 9px; color: #b9c8f2; text-transform: uppercase; }
.sc-quote { font-size: 12px; font-style: italic; color: #dbe4fb; }
.sc-footer {
  background: rgba(0,0,0,.25); text-align: center; font-size: 11px;
  padding: 7px; color: #ffd9bd; font-weight: bold;
}
.share-modal-actions { display: flex; gap: 8px; margin-top: 12px; }
.share-modal-actions .big-btn { font-size: 14px; padding: 11px; }
.big-btn.ghost { background: #555; box-shadow: 0 3px 0 #333; }
.share-hint { text-align: center; color: #eee; font-size: 11px; margin-top: 8px; }

/* ============ TOAST ============ */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #222; color: #fff; padding: 10px 16px; border-radius: 20px;
  font-size: 13px; z-index: 95; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

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

/* screen shake helper */
.shake-hard { animation: shake .4s ease; }

/* ============ RESPONSIVE ============ */
@media (max-width: 380px) {
  .field label { flex-basis: 74px; font-size: 11px; }
  .gov-title h1 { font-size: 17px; }
  #countdown-num { font-size: 44px; }
  .flash-title { font-size: 36px; }
}
