:root {
  --bg: #f5efe4;
  --panel: rgba(255, 252, 247, 0.82);
  --panel-strong: #fffaf2;
  --ink: #172126;
  --muted: #5f6b72;
  --line: rgba(23, 33, 38, 0.1);
  --accent: #0e8f74;
  --accent-strong: #0a6f5a;
  --accent-soft: rgba(14, 143, 116, 0.12);
  --warm: #ff7f3f;
  --shadow: 0 22px 60px rgba(80, 60, 30, 0.14);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 194, 122, 0.35), transparent 32%),
    radial-gradient(circle at top right, rgba(14, 143, 116, 0.18), transparent 28%),
    linear-gradient(180deg, #f6f1e8 0%, #efe4d1 100%);
  position: relative;
}

.page-glow {
  position: fixed;
  width: 28rem;
  height: 28rem;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.45;
  pointer-events: none;
}

.page-glow-left {
  left: -8rem;
  top: -6rem;
  background: rgba(255, 127, 63, 0.22);
}

.page-glow-right {
  right: -8rem;
  top: 14rem;
  background: rgba(14, 143, 116, 0.18);
}

.app-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
  position: relative;
  z-index: 1;
}

.hero-card,
.panel,
.stock-card {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
}

.hero-card {
  border-radius: 32px;
  padding: 28px;
  display: grid;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-strong);
  font-family: "Space Grotesk", sans-serif;
}

h1,
h2,
h3,
strong {
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 0.95;
}

h2 {
  margin: 0;
  font-size: 1.3rem;
}

h3 {
  margin: 0;
  font-size: 1.05rem;
}

.hero-copy,
.stock-note,
#status-text,
.summon-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-badges span,
.soft-pill,
.rank-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
}

.hero-badges span,
.soft-pill {
  background: rgba(255, 255, 255, 0.65);
  color: var(--ink);
  border: 1px solid rgba(23, 33, 38, 0.08);
}

.layout-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 24px;
}

.panel {
  border-radius: var(--radius-xl);
  padding: 24px;
}

.panel-heading,
.block-heading,
.stock-head,
.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.scan-form {
  margin-top: 20px;
  display: grid;
  gap: 14px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
}

.quick-date-row,
.action-row {
  display: flex;
  gap: 10px;
}

.quick-chip,
.secondary-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  border-radius: 999px;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.quick-chip.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: rgba(14, 143, 116, 0.24);
}

.field span,
.summary-card span,
.metric-chip span,
.meta-row span,
.stock-code {
  color: var(--muted);
  font-size: 13px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 15px;
  color: var(--ink);
}

input:focus {
  outline: 2px solid rgba(14, 143, 116, 0.18);
  border-color: rgba(14, 143, 116, 0.4);
}

.primary-btn {
  border: none;
  border-radius: 16px;
  padding: 15px 18px;
  font-size: 15px;
  font-weight: 800;
  color: white;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent) 0%, #0c6a79 100%);
}

.primary-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.meta-card,
.notice-card,
.summary-card,
.stock-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
}

.meta-card,
.notice-card {
  margin-top: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.5);
}

.meta-card {
  display: grid;
  gap: 10px;
}

.notice-card strong {
  display: block;
  margin-bottom: 6px;
}

.network-note {
  margin: 10px 0 0;
  color: #8a4d16;
  font-size: 12px;
  line-height: 1.5;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.summary-card {
  padding: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(252, 247, 238, 0.92));
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
}

.results-block {
  margin-top: 22px;
}

.summon-panel {
  margin-bottom: 22px;
  border-radius: 24px;
  padding: 22px;
  background:
    radial-gradient(circle at top, rgba(255, 188, 110, 0.24), transparent 40%),
    linear-gradient(180deg, rgba(19, 29, 44, 0.94), rgba(39, 24, 18, 0.92));
  color: #f9f2e7;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.summon-panel .soft-pill,
.summon-panel .eyebrow,
.summon-panel h2,
.summon-panel .summon-copy {
  color: inherit;
}

.summon-stage {
  margin-top: 18px;
  min-height: 390px;
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 58%, rgba(87, 226, 194, 0.34), transparent 24%),
    radial-gradient(circle at 48% 42%, rgba(255, 213, 121, 0.28), transparent 30%),
    linear-gradient(145deg, rgba(8, 18, 25, 0.98), rgba(38, 26, 15, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -40px 80px rgba(0, 0, 0, 0.22);
}

.summon-stage::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.9), transparent 72%);
  -webkit-mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.9), transparent 72%);
  pointer-events: none;
}

.smoke-stack {
  position: absolute;
  left: 50%;
  top: 30px;
  width: 240px;
  height: 170px;
  transform: translateX(-50%);
  pointer-events: none;
}

.smoke {
  position: absolute;
  bottom: 0;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(131, 220, 201, 0.8), rgba(82, 176, 167, 0.18) 70%, transparent 72%);
  filter: blur(8px);
  opacity: 0;
  transform: translateY(30px) scale(0.7);
}

.smoke-a { left: 24px; }
.smoke-b { left: 72px; bottom: 22px; }
.smoke-c { left: 118px; }

.smoke-stack.is-rising .smoke-a { animation: smokeRise 2.2s ease-out infinite; }
.smoke-stack.is-rising .smoke-b { animation: smokeRise 2.2s 0.35s ease-out infinite; }
.smoke-stack.is-rising .smoke-c { animation: smokeRise 2.2s 0.7s ease-out infinite; }

.stock-sparks {
  position: absolute;
  inset: 22px 18px auto;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  pointer-events: none;
  z-index: 4;
}

.spark-card {
  min-width: 112px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(247, 250, 245, 0.92);
  color: #172126;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
  transform: translateY(18px) scale(0.9);
  opacity: 0;
  animation: sparkIn 0.55s ease forwards;
}

.spark-card span,
.spark-card em,
.spark-card small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-style: normal;
}

.spark-card strong {
  display: block;
  margin: 4px 0;
}

.magic-dust {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.dust {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 244, 188, 0.95), rgba(124, 244, 215, 0.2));
  opacity: 0;
}

.dust-a { left: 46%; bottom: 122px; }
.dust-b { left: 52%; bottom: 138px; }
.dust-c { left: 40%; bottom: 112px; }
.dust-d { left: 58%; bottom: 130px; }

.magic-dust.is-awake .dust-a { animation: dustLift 1.4s ease-out infinite; }
.magic-dust.is-awake .dust-b { animation: dustLift 1.8s 0.2s ease-out infinite; }
.magic-dust.is-awake .dust-c { animation: dustLift 1.6s 0.45s ease-out infinite; }
.magic-dust.is-awake .dust-d { animation: dustLift 1.5s 0.65s ease-out infinite; }

.magic-orb {
  position: absolute;
  left: 50%;
  top: 58px;
  width: 132px;
  height: 132px;
  transform: translateX(-50%);
  border-radius: 999px;
  background:
    radial-gradient(circle at 38% 35%, rgba(255, 245, 205, 0.95), rgba(80, 225, 194, 0.52) 38%, rgba(80, 225, 194, 0.08) 70%, transparent 72%);
  box-shadow:
    0 0 42px rgba(80, 225, 194, 0.45),
    inset 0 0 30px rgba(255, 255, 255, 0.32);
  pointer-events: none;
}

.magic-orb span {
  position: absolute;
  inset: 24px;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.28);
  transform: rotate(-12deg);
}

.decorative-lamp {
  position: absolute;
  left: 50%;
  bottom: 112px;
  width: min(74%, 300px);
  height: 166px;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 2;
  background: url("./assets/aladdin-lamp-cutout.png") center bottom / contain no-repeat;
  filter:
    drop-shadow(0 20px 22px rgba(0, 0, 0, 0.32))
    drop-shadow(0 0 18px rgba(255, 205, 112, 0.16));
}

.decorative-lamp > span {
  display: none;
}

.lamp-body {
  position: absolute;
  left: 26%;
  bottom: 18px;
  width: 50%;
  height: 62px;
  border-radius: 48% 52% 44% 46% / 58% 60% 40% 42%;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 249, 206, 0.88), transparent 18%),
    linear-gradient(135deg, #fff0a8 0%, #e2a63c 42%, #8c4f0b 100%);
  box-shadow:
    inset 0 12px 18px rgba(255, 255, 255, 0.28),
    inset 0 -14px 24px rgba(86, 42, 5, 0.42);
}

.lamp-body::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  top: 18px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 249, 220, 0.38);
  transform: rotate(-5deg);
}

.lamp-lid {
  position: absolute;
  left: 40%;
  bottom: 76px;
  width: 26%;
  height: 34px;
  border-radius: 54% 46% 20% 22% / 64% 64% 30% 30%;
  background: linear-gradient(135deg, #ffe8a0 0%, #d5952b 58%, #7b4208 100%);
  transform: rotate(7deg);
}

.lamp-lid::before {
  content: "";
  position: absolute;
  left: 34%;
  top: -20px;
  width: 36%;
  height: 24px;
  border-radius: 50% 50% 18% 18%;
  background: linear-gradient(135deg, #fff0b4, #b76c14);
}

.lamp-spout {
  position: absolute;
  right: 5%;
  bottom: 40px;
  width: 36%;
  height: 42px;
  border-radius: 0 82% 70% 0 / 0 70% 56% 0;
  background: linear-gradient(135deg, #f4c45c 0%, #b16c16 62%, #6b3808 100%);
  transform: rotate(6deg);
  clip-path: polygon(0 35%, 66% 18%, 100% 32%, 70% 54%, 0 78%);
}

.lamp-handle {
  position: absolute;
  left: 8%;
  bottom: 34px;
  width: 31%;
  height: 58px;
  border: 10px solid rgba(221, 157, 49, 0.95);
  border-right: 0;
  border-radius: 64% 0 0 64% / 58% 0 0 58%;
  transform: rotate(-5deg);
  box-shadow: inset 6px 0 0 rgba(117, 61, 8, 0.38);
}

.lamp-foot {
  position: absolute;
  left: 35%;
  bottom: 2px;
  width: 34%;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(90deg, #7a4308, #e7b653 48%, #704006);
}

.summon-direct {
  position: absolute;
  left: 50%;
  bottom: 50px;
  transform: translateX(-50%);
  z-index: 3;
  width: min(82%, 320px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(135deg, #ffe08a, #4fe0bf);
  color: #3d2206;
  border-radius: 20px;
  padding: 17px 22px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.26);
  touch-action: manipulation;
}

.summon-direct:active {
  transform: translateX(-50%) translateY(1px);
}

.summon-direct:disabled {
  opacity: 0.72;
  cursor: default;
}

.summon-stage.is-awake .summon-direct {
  display: none;
}

.summon-hint {
  position: absolute;
  left: 50%;
  bottom: 18px;
  width: min(84%, 360px);
  margin: 0;
  transform: translateX(-50%);
  color: rgba(255, 245, 228, 0.78);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.results-reveal {
  transition: opacity 260ms ease, transform 260ms ease, filter 260ms ease;
}

.results-reveal.is-locked {
  opacity: 0.28;
  transform: translateY(10px);
  filter: blur(3px);
  pointer-events: none;
}

.stock-list {
  margin-top: 16px;
  display: grid;
  gap: 14px;
}

.stock-card {
  padding: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(251, 246, 236, 0.88));
}

.stock-code {
  margin: 0 0 6px;
}

.rank-pill {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.metrics-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metric-chip {
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(23, 33, 38, 0.08);
}

.metric-chip strong {
  display: block;
  margin-top: 4px;
  font-size: 1rem;
}

.empty-state {
  padding: 26px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(23, 33, 38, 0.16);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.4);
}

@media (max-width: 1080px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }

  .controls-panel {
    order: 1;
  }

  .results-panel {
    order: 2;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 100%);
    padding-top: 16px;
  }

  .hero-card,
  .panel {
    padding: 18px;
    border-radius: 22px;
  }

  .field-grid,
  .summary-grid,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .quick-date-row,
  .action-row {
    flex-wrap: wrap;
  }

  h1 {
    line-height: 1.02;
  }

  .summon-stage {
    min-height: 430px;
  }

  .stock-sparks {
    inset: 18px 14px auto;
    gap: 8px;
    justify-content: center;
  }

  .spark-card {
    width: min(44%, 112px);
    min-width: 0;
    padding: 8px 9px;
    border-radius: 14px;
  }

  .spark-card span,
  .spark-card em,
  .spark-card small {
    font-size: 10px;
  }

  .spark-card strong {
    margin: 2px 0;
    font-size: 14px;
    line-height: 1.2;
  }

  .summon-stage.is-awake .stock-sparks {
    max-height: 172px;
    overflow: hidden;
  }

  .magic-orb {
    top: 112px;
    width: 124px;
    height: 124px;
  }

  .decorative-lamp {
    bottom: 96px;
    width: min(86%, 280px);
  }

  .summon-direct {
    bottom: 48px;
    width: min(88%, 300px);
  }
}

@keyframes smokeRise {
  0% {
    opacity: 0;
    transform: translateY(28px) scale(0.7);
  }
  20% {
    opacity: 0.75;
  }
  100% {
    opacity: 0;
    transform: translateY(-70px) scale(1.4);
  }
}

@keyframes sparkIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes dustLift {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.6);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(0, -110px, 0) scale(1.6);
  }
}
