:root {
  --purple: #7c5cff;
  --purple-2: #a276f7;
  --purple-soft: #f0ebff;
  --pink: #ff4f8d;
  --text: #333333;
  --muted: #888888;
  --line: #ebe5df;
  --gold: #ffc400;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  background: #d8d4cf;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.phone-shell {
  width: min(100vw, 430px);
  height: min(100vh, 860px);
  padding: 14px;
}

.phone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #fff;
  border: 3px solid #222;
  border-radius: 48px;
  box-shadow: 0 18px 40px rgba(45, 38, 30, 0.15);
}

.status-bar {
  position: absolute;
  z-index: 10;
  top: 33px;
  left: 30px;
  right: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.clock {
  font-size: 18px;
  font-weight: 800;
}

.status-icons {
  color: #5f7fa7;
  font-size: 13px;
  letter-spacing: 2px;
}

.wallet {
  position: absolute;
  z-index: 12;
  top: 84px;
  right: 31px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #777;
  font-weight: 700;
}

.purchase-button {
  border: 1.8px solid var(--purple);
  border-radius: 7px;
  background: #fff;
  color: var(--purple);
  padding: 8px 12px;
  font-weight: 800;
}

.view {
  display: none;
  height: 100%;
  padding: 122px 30px 92px;
}

.view.is-active {
  display: block;
}

.view-gacha {
  padding: 0 30px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f7f4ff 58%, #ffffff 100%);
}

.view-get {
  padding: 0 24px;
}

.view-result {
  overflow-y: auto;
  padding-bottom: 138px;
  -webkit-overflow-scrolling: touch;
}

.gacha-scene {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 56px;
}

.gacha-kicker {
  margin: 0 0 12px;
  color: var(--purple);
  font-size: 14px;
  font-weight: 900;
}

.gacha-scene h1 {
  margin: 0;
  color: #2f2f2f;
  font-family: Georgia, "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 25px;
  line-height: 1.45;
}

.cave-stage {
  position: relative;
  width: min(100%, 270px);
  height: 286px;
  margin: 28px auto 26px;
  overflow: hidden;
  border-radius: 24px;
  background:
    linear-gradient(180deg, #514574 0%, #251f34 57%, #f7f4ff 57%, #ffffff 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.52), 0 18px 34px rgba(81, 69, 116, 0.18);
}

.cave-arch {
  position: absolute;
  left: 22px;
  right: 22px;
  top: 24px;
  height: 180px;
  border-radius: 100px 100px 18px 18px;
  background:
    linear-gradient(180deg, #16131e 0%, #2d2541 68%, #7565a7 100%);
  box-shadow: inset 0 18px 36px rgba(255, 255, 255, 0.08);
}

.spring-light {
  position: absolute;
  left: 50%;
  bottom: 55px;
  width: 135px;
  height: 40px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #d8ccff;
  box-shadow: 0 0 34px rgba(162, 118, 247, 0.72);
}

.stone-gacha {
  position: absolute;
  left: 50%;
  bottom: 75px;
  width: 92px;
  height: 65px;
  transform: translateX(-50%);
}

.gacha-button {
  width: min(100%, 270px);
}

.gacha-note {
  width: min(100%, 290px);
  margin: 18px 0 0;
  color: #8b8b8b;
  font-size: 13px;
  line-height: 1.6;
  font-weight: 750;
}

.back-button {
  position: absolute;
  z-index: 13;
  top: 82px;
  left: 29px;
  min-width: 72px;
  height: 36px;
  border: 1px solid #e4dcff;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--purple);
  font-size: 14px;
  font-weight: 900;
}

.get-center {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 58px;
}

.theme-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  height: 31px;
  padding: 0 18px;
  border: 1.5px solid #f4afca;
  border-radius: 999px;
  background: #ffe7f1;
  color: var(--pink);
  font-size: 15px;
  font-weight: 800;
}

.stone-visual {
  --stone-a: #ff5a73;
  --stone-b: #c92747;
  --stone-c: #6c1f32;
  position: relative;
  flex: none;
  background:
    radial-gradient(circle at 24% 42%, rgba(255, 255, 255, 0.72), transparent 12%),
    radial-gradient(circle at 72% 33%, rgba(255, 255, 255, 0.35), transparent 13%),
    radial-gradient(circle at 42% 70%, rgba(0, 0, 0, 0.32), transparent 20%),
    linear-gradient(135deg, var(--stone-a), var(--stone-b) 54%, var(--stone-c));
  clip-path: polygon(8% 44%, 20% 20%, 42% 13%, 59% 21%, 78% 16%, 95% 40%, 84% 69%, 62% 82%, 38% 76%, 17% 83%, 2% 61%);
  filter: saturate(1.2) contrast(1.08);
  box-shadow: 0 16px 34px rgba(150, 76, 245, 0.18);
}

.stone-visual::after {
  content: "";
  position: absolute;
  inset: 13%;
  background:
    radial-gradient(circle at 35% 40%, rgba(0, 0, 0, 0.27), transparent 18%),
    radial-gradient(circle at 65% 58%, rgba(255, 255, 255, 0.28), transparent 18%),
    linear-gradient(80deg, transparent 0 40%, rgba(255, 255, 255, 0.18), transparent 60% 100%);
  clip-path: polygon(8% 44%, 20% 20%, 42% 13%, 59% 21%, 78% 16%, 95% 40%, 84% 69%, 62% 82%, 38% 76%, 17% 83%, 2% 61%);
  mix-blend-mode: overlay;
}

.stone-large {
  width: 130px;
  height: 92px;
  margin: 28px 0 18px;
}

.stone-thumb {
  width: 38px;
  height: 27px;
}

.stone-mini {
  width: 31px;
  height: 22px;
}

.title-name {
  margin: 2px 0 2px;
  color: var(--purple);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0;
}

.stone-heading {
  margin: 0;
  font-size: 24px;
  line-height: 1.4;
  font-family: Georgia, "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-weight: 800;
}

.brightness {
  width: min(100%, 175px);
  margin-top: 18px;
}

.brightness-label {
  color: var(--purple);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
}

.brightness-score {
  margin-top: 6px;
  color: #623fd8;
  font-family: Georgia, serif;
  font-size: 28px;
  font-weight: 800;
}

.brightness-score small {
  color: #b8b8b8;
  font-family: inherit;
  font-size: 16px;
}

.brightness-bar {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #ebe9f2;
}

.brightness-bar span {
  display: block;
  width: 97%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--purple), #a779ff);
}

.flavor {
  width: min(100%, 282px);
  margin: 17px auto 22px;
  color: #777;
  font-family: Georgia, "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 15px;
  line-height: 1.8;
}

.action-stack {
  width: min(100%, 270px);
  display: grid;
  gap: 10px;
}

.primary-button,
.outline-button {
  width: 100%;
  min-height: 57px;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 900;
}

.primary-button {
  border: 0;
  background: linear-gradient(135deg, var(--purple), var(--purple-2));
  color: #fff;
  box-shadow: 0 14px 24px rgba(124, 92, 255, 0.22);
}

.primary-button:disabled {
  opacity: 0.66;
  cursor: wait;
}

.outline-button {
  border: 2px solid var(--purple);
  background: #fff;
  color: var(--purple);
}

.note,
.collection-count {
  margin: 17px auto 0;
  color: #b5b5b5;
  font-size: 13px;
  line-height: 1.65;
  font-weight: 700;
}

.collection-count {
  margin-top: 12px;
}

.info-button {
  position: absolute;
  right: 22px;
  bottom: 23px;
  width: 34px;
  height: 34px;
  border: 1.5px solid #d9cdfd;
  border-radius: 999px;
  background: #f3efff;
  color: var(--purple);
  font-weight: 900;
}

.summary-band {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 13px 22px;
  border-radius: 14px;
  background: var(--purple-soft);
}

.summary-theme {
  color: var(--purple);
  font-size: 14px;
  font-weight: 800;
}

.summary-band strong,
.detail-summary strong {
  display: block;
  margin-top: 2px;
  font-size: 16px;
  line-height: 1.35;
}

.overall-block {
  margin-top: 33px;
}

.overall-block h2 {
  margin: 0;
  color: #777;
  font-size: 16px;
}

.free-badge {
  display: inline-flex;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 6px;
  background: #dff6ed;
  color: #15936c;
  font-size: 13px;
}

.big-stars {
  margin-top: 23px;
  text-align: center;
  font-size: 38px;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
}

.star-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--gold);
}

.star-filled {
  color: var(--gold);
}

.star-empty {
  color: #d7d7d7;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-top: 26px;
}

.category-grid article {
  min-width: 0;
  min-height: 55px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #777;
  font-weight: 800;
}

.category-grid span {
  font-size: 14px;
}

.category-grid strong {
  font-size: 14px;
  letter-spacing: 0;
}

.paywall-card {
  position: relative;
  margin-top: 22px;
  padding: 24px 22px 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: #444;
}

.paywall-card p {
  margin: 0;
  font-size: 17px;
  line-height: 1.85;
  font-weight: 800;
}

.blur-row {
  height: 40px;
  margin-top: 12px;
  border-radius: 12px;
  background: linear-gradient(90deg, #ececec, #f6f6f6, #e6e6e6);
  filter: blur(5px);
  opacity: 0.82;
}

.lock-row {
  display: grid;
  justify-items: center;
  gap: 5px;
  margin-top: -25px;
  color: #777;
  font-weight: 800;
}

.lock-row strong {
  color: var(--purple);
}

.result-actions {
  margin: 26px auto 0;
  width: min(100%, 295px);
}

.result-actions .primary-button span {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  opacity: 0.8;
}

.detail-title {
  margin: 4px 0 30px;
  text-align: center;
  font-size: 20px;
}

.detail-summary {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 17px;
}

.detail-scroll {
  height: calc(100% - 84px);
  overflow-y: auto;
  padding: 0 2px 98px;
  scrollbar-color: #bfbfbf transparent;
}

.fortune-card,
.lucky-card,
.advisor-card {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.fortune-head {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 10px;
}

.fortune-head h2,
.lucky-card h2,
.advisor-card h2 {
  margin: 0;
  font-size: 19px;
}

.fortune-head strong {
  font-size: 17px;
  white-space: nowrap;
}

.fortune-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-weight: 900;
}

.love-icon {
  background: #ffe1ef;
  color: #ff4f9f;
}

.work-icon {
  background: #e8f4ff;
  color: #5f86b7;
}

.money-icon {
  background: #fff5d7;
  color: #b88410;
}

.health-icon {
  background: #e8f8ec;
  color: #43a164;
}

.fortune-card p,
.advisor-card p {
  margin: 15px 0 0;
  color: #555;
  font-size: 16px;
  line-height: 1.75;
  font-weight: 750;
}

.lucky-card {
  border-color: #ffd894;
  background: #fffaf0;
}

.lucky-card dl {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 16px 0 0;
}

.lucky-card div {
  min-width: 0;
  padding: 12px;
  border-radius: 10px;
  background: #fff;
}

.lucky-card dt {
  color: #a98030;
  font-size: 12px;
  font-weight: 900;
}

.lucky-card dd {
  margin: 5px 0 0;
  font-weight: 850;
  line-height: 1.4;
}

.bottom-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 11;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  min-height: 72px;
  padding: 8px 18px 10px;
  border-top: 1px solid #eee;
  background: rgba(255, 255, 255, 0.96);
}

.bottom-nav button {
  border: 0;
  background: transparent;
  color: #b1b1b1;
  font-size: 12px;
  font-weight: 800;
}

.bottom-nav span {
  display: block;
  margin-bottom: 2px;
  font-size: 22px;
  line-height: 1;
}

.bottom-nav .is-active {
  color: var(--purple);
}

.toast {
  position: absolute;
  z-index: 30;
  left: 24px;
  right: 24px;
  bottom: 94px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(45, 45, 45, 0.94);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 750;
}

.settings-dialog {
  width: min(92vw, 380px);
  padding: 0;
  border: 0;
  border-radius: 18px;
}

.settings-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.settings-panel {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.settings-panel h2 {
  margin: 0 0 2px;
}

.settings-panel label {
  display: grid;
  gap: 6px;
  color: #555;
  font-size: 13px;
  font-weight: 800;
}

.settings-panel input,
.settings-panel textarea {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 10px 11px;
}

.settings-panel textarea {
  min-height: 74px;
  resize: vertical;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.compact {
  min-height: 44px;
  font-size: 15px;
}

@media (max-width: 390px) {
  .phone-shell {
    padding: 0;
  }

  .phone-screen {
    border-radius: 0;
    border: 0;
  }

  .view {
    padding-left: 24px;
    padding-right: 24px;
  }

  .category-grid {
    gap: 6px;
  }

  .category-grid span,
  .category-grid strong {
    font-size: 12px;
  }
}
