:root {
  color-scheme: dark;
  --bg: #070a12;
  --card: rgba(23, 26, 51, 0.82);
  --card-strong: #171a33;
  --line: rgba(185, 135, 56, 0.56);
  --green: #12c96b;
  --green-dark: #069b4e;
  --orange: #ff9800;
  --purple: #7859e8;
  --text: #fff;
  --muted: #b9bed6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 15%, rgba(18, 201, 107, 0.28), transparent 26%),
    radial-gradient(circle at 18% 6%, rgba(255, 152, 0, 0.18), transparent 22%),
    linear-gradient(160deg, #050711 0%, #101323 42%, #050711 100%);
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  content: "";
  background:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, #000, transparent 82%);
  pointer-events: none;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.phone-shell {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 14px 100px;
  position: relative;
}

.hero-card,
.lottery-panel,
.invite-card,
.claim-card,
.rules-card,
.welcome-box,
.form-modal,
.redeem-guide-modal,
.line-guide {
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255,255,255,0.08);
  backdrop-filter: blur(14px);
  border-radius: 24px;
}

.hero-card {
  padding: 18px;
  min-height: 160px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--orange);
  font-size: 12px;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 28px;
  line-height: 1.08;
}

.hero-subtitle {
  color: var(--muted);
  font-size: 14px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  background: rgba(255,255,255,0.12);
}

.notice-strip {
  margin-top: 20px;
  padding: 10px 12px;
  border-radius: 999px;
  color: #fdf6d8;
  background: rgba(255, 152, 0, 0.14);
  font-size: 13px;
  overflow: hidden;
  white-space: nowrap;
}

.lottery-panel,
.invite-card,
.claim-card,
.rules-card {
  margin-top: 14px;
  padding: 16px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-weight: 800;
}

.panel-title small {
  color: var(--orange);
  font-size: 12px;
  text-align: right;
}

.slot-machine {
  position: relative;
  display: grid;
  place-items: center;
  margin: 12px auto 16px;
  width: 260px;
  height: 260px;
}

.slot-glow {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--green), var(--orange), #6b4de6, var(--green));
  filter: blur(9px);
  opacity: 0.78;
  animation: rotateGlow 7s linear infinite;
}

.slot-window {
  position: relative;
  width: 230px;
  height: 230px;
  border: 12px solid rgba(255, 152, 0, 0.7);
  border-radius: 50%;
  overflow: hidden;
  background: #0d1020;
  box-shadow: inset 0 0 28px rgba(0,0,0,0.75);
}

.slot-window::before,
.slot-window::after {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  height: 42%;
  content: "";
  pointer-events: none;
}

.slot-window::before {
  top: 0;
  background: linear-gradient(to bottom, rgba(13,16,32,0.98), transparent);
}

.slot-window::after {
  bottom: 0;
  background: linear-gradient(to top, rgba(13,16,32,0.98), transparent);
}

.slot-reel {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-42px);
}

.slot-item {
  height: 84px;
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 800;
  color: #fff;
}

.slot-item b {
  display: block;
  font-size: 34px;
}

.slot-item span {
  display: block;
  margin-top: 4px;
  font-size: 14px;
}

.slot-reel.spinning {
  animation: slotSpin 0.22s linear infinite;
}

.primary-btn,
.orange-btn,
.dark-btn,
.ghost-btn,
.spin-btn {
  width: 100%;
  min-height: 50px;
  border-radius: 16px;
  color: #fff;
  font-weight: 900;
}

.primary-btn {
  background: linear-gradient(135deg, var(--green), #15d878);
  box-shadow: 0 13px 30px rgba(18, 201, 107, 0.28);
}

.orange-btn {
  background: linear-gradient(135deg, #ff6b00, var(--orange));
  box-shadow: 0 13px 30px rgba(255, 152, 0, 0.26);
}

.dark-btn {
  margin-top: 10px;
  background: rgba(255,255,255,0.1);
  color: var(--muted);
}

.ghost-btn {
  margin-top: 10px;
  background: transparent;
  color: var(--muted);
}

.spin-btn {
  background: linear-gradient(135deg, #ff6b00, var(--orange));
  letter-spacing: 0.1em;
}

.draw-count {
  margin-top: 12px;
  text-align: center;
  color: var(--muted);
}

.draw-count strong {
  color: var(--green);
  font-size: 22px;
}

.invite-card h2,
.rules-card h2 {
  margin-bottom: 8px;
  color: var(--green);
  font-size: 18px;
}

.invite-card p,
.rules-card li,
.claim-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.copy-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.copy-row input {
  min-width: 0;
  flex: 1;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  color: #fff;
  background: rgba(0,0,0,0.24);
}

.copy-row button {
  width: 76px;
  border-radius: 12px;
  color: #fff;
  background: var(--green);
  font-weight: 800;
}

.invite-stats {
  display: flex;
  justify-content: space-around;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.invite-stats strong {
  color: var(--green);
}

.progress-steps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin: 8px 0 14px;
}

.progress-steps span {
  padding: 6px 2px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.inline-actions {
  display: grid;
  gap: 10px;
}

.reward-code {
  margin: 12px 0;
  padding: 14px;
  border: 1px dashed rgba(18,201,107,0.55);
  border-radius: 14px;
  background: rgba(18,201,107,0.1);
  color: #dfffe9;
  font-size: 18px;
  font-weight: 900;
  word-break: break-all;
}

.rules-card ul {
  padding-left: 20px;
  margin-bottom: 0;
}

.modal-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(8px);
}

.welcome-box,
.form-modal,
.redeem-guide-modal,
.line-guide {
  width: min(100%, 360px);
  padding: 24px 18px;
  text-align: center;
}

.phone-claim-modal {
  width: min(100%, 390px);
  padding: 0 0 18px;
  overflow: hidden;
  border: 0;
  background: #f7f8f8;
  color: #151515;
  text-align: left;
}

.phone-green-header {
  position: relative;
  display: grid;
  place-items: center;
  height: 58px;
  background: #06c755;
  color: #fff;
  font-weight: 900;
}

.phone-back {
  position: absolute;
  left: 12px;
  top: 10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 30px;
  line-height: 1;
}

.phone-line-badge {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: -10px auto 16px;
  border: 6px solid #fff;
  border-radius: 50%;
  background: #06c755;
  color: #fff;
  box-shadow: 0 8px 22px rgba(6, 199, 85, 0.28);
  font-size: 12px;
  font-weight: 900;
}

.phone-claim-modal h2,
.phone-claim-modal p,
.phone-claim-modal small,
.phone-input-label,
.tw-phone-row,
.line-submit-btn {
  margin-left: 16px;
  margin-right: 16px;
}

.phone-claim-modal h2 {
  margin-bottom: 8px;
  text-align: center;
  font-size: 20px;
}

.phone-claim-modal p {
  color: #6b7280;
  text-align: center;
  font-size: 13px;
  line-height: 1.6;
}

.phone-input-label {
  display: block;
  margin-top: 22px;
  margin-bottom: 8px;
  color: #222;
  font-size: 13px;
  font-weight: 800;
}

.tw-phone-row {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 8px;
}

.tw-phone-row span,
.tw-phone-row input {
  height: 46px;
  border: 1px solid #dde1e7;
  border-radius: 10px;
  background: #fff;
  color: #111827;
}

.tw-phone-row span {
  display: grid;
  place-items: center;
  font-size: 13px;
}

.tw-phone-row input {
  min-width: 0;
  padding: 0 12px;
  font-size: 15px;
}

.line-submit-btn {
  width: calc(100% - 32px);
  min-height: 48px;
  margin-top: 16px;
  border-radius: 10px;
  background: linear-gradient(135deg, #06c755, #05b64c);
  color: #fff;
  box-shadow: 0 10px 24px rgba(6, 199, 85, 0.22);
  font-weight: 900;
}

.phone-claim-modal small {
  display: block;
  margin-top: 14px;
  padding: 10px;
  border-radius: 10px;
  background: #eef2f7;
  color: #6b7280;
  font-size: 12px;
}

.gift-icon {
  font-size: 48px;
  filter: drop-shadow(0 10px 20px rgba(255,152,0,0.35));
}

.welcome-box h2 {
  margin: 12px 0 8px;
  font-size: 22px;
}

.welcome-box h3 {
  color: var(--orange);
  font-size: 15px;
}

.welcome-box p,
.form-modal p,
.line-guide p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.big-input {
  width: 100%;
  height: 58px;
  margin: 8px 0 18px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: #eef4ff;
  color: #0d1020;
  font-size: 18px;
}

.redeem-guide-modal {
  position: relative;
}

.redeem-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  border-radius: 18px;
  background: rgba(255, 152, 0, 0.16);
  font-size: 34px;
}

.redeem-guide-modal h2 {
  margin-bottom: 8px;
  color: #fff;
  font-size: 20px;
}

.redeem-guide-modal p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.redeem-code {
  margin: 14px 0 10px;
  padding: 13px;
  border: 1px dashed rgba(18, 201, 107, 0.7);
  border-radius: 14px;
  background: rgba(18, 201, 107, 0.12);
  color: #dfffe9;
  font-size: 17px;
  font-weight: 900;
  word-break: break-all;
}

.redeem-steps {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  text-align: left;
}

.redeem-steps div {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  color: var(--muted);
  font-size: 13px;
}

.redeem-steps b {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
}

.orange-link-btn {
  display: grid;
  place-items: center;
  min-height: 50px;
  border-radius: 16px;
  background: linear-gradient(135deg, #e9322d, #ff5a37);
  color: #fff;
  text-decoration: none;
  font-weight: 900;
}

.line-guide {
  position: relative;
  max-height: 92vh;
  overflow-y: auto;
}

.close-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: rgba(255,255,255,0.12);
  font-size: 22px;
}

.line-badge {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 10px 28px rgba(18,201,107,0.35);
  font-weight: 900;
}

.guide-steps {
  display: grid;
  gap: 8px;
  text-align: left;
}

.guide-steps div {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  color: var(--muted);
  font-size: 13px;
}

.guide-steps b {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
}

.guide-preview {
  margin: 14px 0;
  padding: 12px;
  border-radius: 14px;
  background: #f7f7f7;
}

.phone-mock {
  color: #1b1b1b;
  text-align: left;
}

.mock-header {
  height: 38px;
  border-radius: 12px 12px 4px 4px;
  background: #06c755;
}

.mock-row {
  margin-top: 8px;
  padding: 9px;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
}

.red-mark {
  border: 2px solid #e83a3a;
}

#lineProofInput {
  width: 100%;
  margin: 10px 0 12px;
  color: var(--muted);
}

.floating-chat {
  position: fixed;
  z-index: 15;
  right: max(18px, calc((100vw - 430px) / 2 + 18px));
  bottom: 22px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green), #1ee88a);
  box-shadow: 0 14px 30px rgba(18,201,107,0.36);
  font-size: 24px;
}

.chat-sheet {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(100%, 430px);
  height: min(78vh, 680px);
  transform: translateX(-50%);
  border-radius: 22px 22px 0 0;
  overflow: hidden;
  background: #23243a;
  box-shadow: 0 -22px 70px rgba(0,0,0,0.52);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: linear-gradient(135deg, #6958dc, #8d59d6);
}

.chat-header .avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
}

.chat-header h3,
.chat-header p {
  margin: 0;
}

.chat-header p {
  color: #d9ffd9;
  font-size: 12px;
}

.chat-header button {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: rgba(255,255,255,0.16);
  font-size: 22px;
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

.msg {
  max-width: 82%;
  margin-bottom: 12px;
}

.msg .bubble {
  padding: 11px 13px;
  border-radius: 16px;
  line-height: 1.5;
  font-size: 14px;
  white-space: pre-wrap;
}

.msg.user {
  margin-left: auto;
}

.msg.user .bubble {
  background: var(--green);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg.admin .bubble,
.msg.system .bubble {
  background: rgba(255,255,255,0.11);
  color: #fff;
  border-bottom-left-radius: 4px;
}

.msg small {
  display: block;
  margin-top: 4px;
  color: rgba(255,255,255,0.44);
  font-size: 11px;
}

.quick-replies {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  overflow-x: auto;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.quick-replies button {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 999px;
  color: #9fb4ff;
  background: rgba(90, 111, 210, 0.25);
}

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 14px 14px;
}

.chat-input-row input {
  min-width: 0;
  flex: 1;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 999px;
  color: #fff;
  background: transparent;
}

.chat-input-row button {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #8d79ff, #6d54ff);
  font-size: 20px;
}

.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 96px;
  max-width: min(360px, calc(100vw - 32px));
  transform: translateX(-50%);
  padding: 12px 14px;
  border-radius: 999px;
  color: #fff;
  background: rgba(0, 0, 0, 0.78);
  box-shadow: 0 12px 32px rgba(0,0,0,0.35);
  font-size: 14px;
}

.hidden {
  display: none !important;
}

@keyframes rotateGlow {
  to {
    transform: rotate(360deg);
  }
}

@keyframes slotSpin {
  from {
    transform: translateY(-42px);
  }
  to {
    transform: translateY(-378px);
  }
}

@media (min-width: 680px) {
  .phone-shell {
    padding-top: 28px;
  }
}
