:root {
  --bg:         oklch(99% 0.01 95);
  --surface:    oklch(100% 0 0);
  --fg:         oklch(18% 0.02 260);
  --muted:      oklch(42% 0.03 260);
  --border:     oklch(75% 0.04 260);

  --pop-red:    oklch(58% 0.26 25);
  --pop-yellow: oklch(88% 0.18 95);
  --pop-cyan:   oklch(78% 0.14 210);
  --pop-blue:   oklch(55% 0.2 250);
  --pop-green:  oklch(68% 0.16 145);
  --pop-pink:   oklch(72% 0.18 350);
  --pop-orange: oklch(72% 0.2 55);

  --font-display: 'M PLUS Rounded 1c', 'Zen Kaku Gothic New', 'Noto Sans JP', sans-serif;
  --font-body:    'Zen Kaku Gothic New', 'M PLUS Rounded 1c', 'Noto Sans JP', sans-serif;
  --font-ui:      'M PLUS Rounded 1c', 'Zen Kaku Gothic New', 'Noto Sans JP', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.43;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
input { font: inherit; }

/* ─── Animations ─── */

@keyframes marquee-scroll {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(var(--marquee-end, -50%), 0, 0); }
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: .35; }
}

@keyframes bounce-y {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

@keyframes pop-in {
  0% { transform: scale(.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes check-pop {
  0% { transform: scale(0); }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

@keyframes confetti-fall {
  0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(30px) rotate(360deg); opacity: 0; }
}

/* ─── Marquee Banner ─── */

.marquee-wrap {
  width: 100%;
  overflow: hidden;
  border-bottom: 3px solid var(--fg);
  background: var(--pop-yellow);
  position: relative;
}

.marquee-track {
  display: flex;
  flex-wrap: nowrap;
  width: max-content;
  will-change: transform;
  animation: marquee-scroll var(--marquee-duration, 40s) linear infinite;
}

.marquee-group {
  display: flex;
  flex-shrink: 0;
  flex-wrap: nowrap;
  align-items: stretch;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.marquee-group span {
  flex-shrink: 0;
  padding: 8px 22px;
  border-right: 2px solid var(--fg);
  line-height: 1.2;
  font-size: 13px;
}

.marquee-group .hot {
  background: var(--pop-red);
  color: var(--surface);
  text-shadow: 1px 1px 0 color-mix(in oklch, var(--fg) 40%, transparent);
}

/* ─── Page Shell ─── */

.page-shell {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 22px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ─── Header ─── */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 18px;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 3px solid var(--fg);
  margin-bottom: 20px;
}

.logo-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-main {
  font-family: var(--font-display);
  font-size: clamp(38px, 4.4vw, 50px);
  font-weight: 900;
  line-height: 1;
  color: var(--pop-red);
  text-shadow: 3px 3px 0 var(--pop-yellow), 6px 6px 0 var(--fg);
}

.badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 900;
  padding: 5px 12px;
  border: 3px solid var(--fg);
  background: var(--pop-pink);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: 3px 3px 0 var(--fg);
  animation: blink 1.2s step-end infinite;
}

.badge.wl {
  background: var(--pop-cyan);
  font-size: clamp(14px, 1.6vw, 17px);
}

.header-links {
  display: flex;
  gap: 10px;
}

.header-links a {
  font-family: var(--font-display);
  font-size: clamp(15px, 1.8vw, 18px);
  font-weight: 900;
  padding: 8px 16px;
  border: 3px solid var(--fg);
  background: var(--pop-cyan);
  box-shadow: 3px 3px 0 var(--fg);
  letter-spacing: 0.02em;
  transition: background .15s, transform .1s, box-shadow .1s;
}

.header-links a:hover {
  background: var(--pop-green);
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--fg);
}

/* ─── Screen containers ─── */

.screen {
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 22px;
  padding: 28px 0 40px;
  position: relative;
  z-index: 1;
  animation: pop-in .3s ease-out;
  width: 100%;
}

.screen.active { display: flex; }

.form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
  gap: 22px;
  width: 100%;
  align-items: start;
}

.form-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.form-col--main {
  gap: 20px;
}

/* ─── Utilities ─── */

.is-hidden { display: none !important; }

.req { color: var(--pop-red); }

/* ─── Hero / intro ─── */

.hero-card {
  background: var(--surface);
  border: 3px solid var(--fg);
  box-shadow: 6px 6px 0 var(--fg);
  padding: 24px 20px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hero-kao-wrap {
  display: flex;
  justify-content: center;
  padding: 14px 12px;
  background: color-mix(in oklch, var(--pop-yellow) 35%, var(--surface));
  border: 3px dashed var(--fg);
}

.hero-kao-img {
  display: block;
  width: min(100%, 380px);
  height: auto;
  margin: 0 auto;
}

.hero-copy {
  text-align: left;
}

.hero-kicker {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  background: var(--fg);
  color: var(--surface);
  padding: 6px 14px;
  margin-bottom: 12px;
  letter-spacing: 0.06em;
}

.hero-kao {
  font-family: 'Noto Sans JP', 'Noto Sans Symbols 2', 'Segoe UI Symbol', sans-serif;
  font-size: 48px;
  margin-bottom: 16px;
  font-feature-settings: "liga" 0, "kern" 0;
}

/* ─── Connect panel ─── */

.connect-panel {
  width: 100%;
  padding: 16px;
  background: var(--surface);
  border: 3px solid var(--fg);
  box-shadow: 4px 4px 0 var(--fg);
  text-align: center;
}

.connect-panel__label {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 900;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

.hero-kao {
  font-family: var(--font-ui);
  font-size: 48px;
  margin-bottom: 16px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(25px, 3vw, 34px);
  font-weight: 900;
  margin-bottom: 8px;
  line-height: 1.15;
}

.hero-title em {
  font-style: normal;
  color: var(--pop-red);
}

.hero-sub {
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
  max-width: none;
  margin: 0 0 16px;
  line-height: 1.5;
}

.hero-points-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.point-chip {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  padding: 7px 12px;
  border: 2px solid var(--fg);
  background: var(--pop-yellow);
  box-shadow: 2px 2px 0 var(--fg);
}

.point-chip:nth-child(odd) {
  transform: rotate(-1.5deg);
}

.point-chip:nth-child(even) {
  transform: rotate(1deg);
}

.point-chip.highlight {
  background: var(--pop-red);
  color: var(--surface);
  text-shadow: 1px 1px 0 color-mix(in oklch, var(--fg) 35%, transparent);
}

/* ─── Buttons ─── */

.btn-pop {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  padding: 13px 26px;
  border: 3px solid var(--fg);
  background: var(--pop-red);
  color: var(--surface);
  box-shadow: 4px 4px 0 var(--fg);
  transition: transform .1s, box-shadow .1s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-pop:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--fg);
}

.btn-pop:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--fg);
}

.btn-pop.secondary {
  background: var(--pop-yellow);
  color: var(--fg);
}

.btn-pop.ghost {
  background: var(--surface);
  color: var(--fg);
  font-size: 13px;
  padding: 10px 18px;
}

.btn-pop.twitter-btn {
  background: var(--fg);
  color: var(--surface);
  font-size: 16px;
  width: 100%;
  justify-content: center;
}

.btn-pop--large {
  font-size: 18px;
  padding: 15px 32px;
  width: 100%;
  justify-content: center;
}

.btn-pop:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: 4px 4px 0 var(--fg);
}

.btn-small {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border: 2px solid var(--fg);
  background: var(--pop-cyan);
  transition: background .15s;
}

.btn-small:hover { background: var(--pop-green); }

/* ─── User info bar ─── */

.user-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 3px solid var(--fg);
  box-shadow: 4px 4px 0 var(--fg);
  width: 100%;
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--fg);
  object-fit: cover;
}

.user-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  flex: 1;
}

.user-name small {
  display: block;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
}

.points-display {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  color: var(--fg);
  background: var(--pop-yellow);
  border: 2px solid var(--fg);
  padding: 4px 12px;
}

.points-display small {
  color: var(--fg);
}

/* ─── Tasks panel ─── */

.tasks-panel {
  background: var(--surface);
  border: 3px solid var(--fg);
  box-shadow: 6px 6px 0 var(--fg);
  width: 100%;
}

.tasks-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--fg);
  color: var(--surface);
}

.tasks-header h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
}

.tasks-header .en {
  font-family: var(--font-ui);
  font-size: 14px;
  opacity: .85;
}

.task-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 15px 18px;
  border-bottom: 2px solid var(--fg);
  transition: background .15s;
}

.task-item:last-child { border-bottom: none; }

.task-item.completed {
  background: color-mix(in oklch, var(--pop-green) 15%, var(--surface));
}

.task-check {
  width: 28px;
  height: 28px;
  border: 2px solid var(--fg);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.task-item.completed .task-check {
  background: var(--pop-green);
  animation: check-pop .3s ease-out;
}

.task-body h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 900;
}

.task-body p {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 600;
}

.task-body h3:only-child {
  margin-bottom: 0;
}

.task-review-note {
  margin: 6px 0 0;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pop-red);
}

.task-points {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 900;
  padding: 6px 11px;
  border: 2px solid var(--fg);
  background: var(--pop-yellow);
  box-shadow: 2px 2px 0 var(--fg);
  white-space: nowrap;
}

.task-points.required {
  background: var(--pop-red);
  color: var(--surface);
}

.task-points--range {
  background: var(--pop-orange);
  color: var(--fg);
}

.task-points--review {
  background: var(--surface);
  color: var(--fg);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  animation: blink 1.4s step-end infinite;
}

.task-item.completed .task-points--review {
  background: var(--pop-yellow);
}

.points-display small {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.applied-side-panel {
  width: 100%;
  padding: 16px;
  border: 3px solid var(--fg);
  background: var(--surface);
  box-shadow: 6px 6px 0 var(--fg);
}

.applied-side-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.applied-side-panel__header h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  margin: 0;
}

.applied-side-panel__wallet {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 12px;
  word-break: break-all;
}

.applied-side-panel__ref-label {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 8px;
}

.ref-link-wrap--compact {
  margin-bottom: 8px;
}

.ref-link-wrap--compact .ref-link-display {
  font-size: 11px;
  padding: 8px 10px;
}

.ref-share-btn--compact {
  width: 100%;
  justify-content: center;
  font-size: 14px;
  padding: 10px 16px;
  margin-bottom: 6px;
}

.referral-bonus--compact {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.page-shell.is-applied .hero-points-preview {
  display: none;
}

.task-action {
  grid-column: 2 / -1;
  padding-left: 0;
}

/* ─── Wallet input ─── */

.wallet-section {
  width: 100%;
  margin-top: 8px;
  padding-top: 18px;
  border-top: 2px solid var(--border);
}

.wallet-section label {
  display: block;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 900;
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}

.status-note {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

.task-item.task-item--locked {
  opacity: .55;
  pointer-events: none;
}

.wallet-input-wrap {
  display: flex;
  gap: 0;
}

.wallet-input {
  flex: 1;
  width: 100%;
  padding: 12px 14px;
  border: 3px solid var(--fg);
  font-family: var(--font-ui);
  font-size: 15px;
  background: var(--surface);
  outline: none;
}

.wallet-input:focus {
  background: color-mix(in oklch, var(--pop-yellow) 20%, var(--surface));
}

.wallet-input.error {
  background: color-mix(in oklch, var(--pop-red) 10%, var(--surface));
}

.wallet-error {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--pop-red);
  margin-top: 4px;
  min-height: 16px;
}

/* ─── Apply button area ─── */

.apply-area {
  text-align: center;
  width: 100%;
}

/* ─── Success screen ─── */

.success-card {
  background: color-mix(in oklch, var(--pop-green) 20%, var(--surface));
  border: 3px solid var(--fg);
  box-shadow: 6px 6px 0 var(--fg);
  padding: 28px 24px;
  text-align: center;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}

.success-kao-img {
  display: block;
  width: min(100%, 320px);
  height: auto;
  margin: 0 auto 16px;
}

.success-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 900;
  margin-bottom: 8px;
}

.success-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 20px;
}

.score-box {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 32px;
  font-weight: 700;
  color: var(--pop-red);
  background: var(--surface);
  border: 3px solid var(--fg);
  padding: 8px 24px;
  box-shadow: 4px 4px 0 var(--fg);
  margin-bottom: 24px;
}

.score-box small {
  font-size: 14px;
  color: var(--fg);
}

/* ─── Referral section ─── */

.referral-section {
  background: color-mix(in oklch, var(--pop-pink) 20%, var(--surface));
  border: 4px solid var(--fg);
  padding: 24px;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  box-shadow: 6px 6px 0 var(--fg);
}

.referral-section h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 8px;
}

.referral-section p {
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 14px;
}

.ref-link-wrap {
  display: flex;
  gap: 0;
}

.ref-link-display {
  flex: 1;
  padding: 10px 12px;
  background: var(--surface);
  border: 2px solid var(--fg);
  border-right: none;
  font-family: var(--font-ui);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.ref-copy-btn {
  padding: 10px 16px;
  border: 2px solid var(--fg);
  background: var(--pop-yellow);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}

.ref-copy-btn:hover { background: var(--pop-green); }

.ref-share-btn {
  margin-top: 10px;
  width: 100%;
  justify-content: center;
}

.referral-bonus {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border: 2px solid var(--fg);
  background: var(--pop-orange);
  display: inline-block;
  margin-top: 10px;
}

/* ─── Status screen (already applied) ─── */

.status-card {
  background: var(--surface);
  border: 4px solid var(--fg);
  box-shadow: 8px 8px 0 var(--fg);
  padding: 32px;
  text-align: center;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}

#screen-success.active,
#screen-applied.active {
  align-items: center;
}

.status-badge {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  padding: 6px 16px;
  border: 2px solid var(--fg);
  margin-bottom: 12px;
}

.status-badge.pending { background: var(--pop-yellow); }
.status-badge.approved { background: var(--pop-green); }
.status-badge.rejected { background: var(--pop-red); color: var(--surface); }

/* ─── Footer ─── */

.site-footer {
  width: 100%;
  background: var(--fg);
  color: var(--surface);
  font-size: 11px;
  text-align: center;
  padding: 12px;
  font-family: var(--font-ui);
  margin-top: auto;
}

.site-footer a {
  color: var(--pop-yellow);
}

.site-footer a:hover { text-decoration: underline; }

/* ─── Loading spinner ─── */

.loading-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
}

.spinner {
  font-size: 28px;
  animation: bounce-y 1s ease-in-out infinite;
}

/* ─── Disconnect button ─── */

.disconnect-btn {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--muted);
  align-self: center;
  border-bottom: 1px dashed var(--muted);
  cursor: pointer;
}

.disconnect-btn:hover { color: var(--pop-red); border-color: var(--pop-red); }

/* ─── Mobile ─── */

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

@media (max-width: 768px) {
  .page-shell { padding: 18px 12px 0; }

  .hero-card { padding: 24px 18px; }
  .hero-title { font-size: 26px; }
  .hero-sub { font-size: 16px; }

  .logo-main { font-size: 38px; }

  .site-header {
    justify-content: center;
    text-align: center;
  }

  .task-item {
    grid-template-columns: 36px 1fr auto;
    gap: 10px;
    padding: 14px;
  }

  .btn-pop.twitter-btn { font-size: 17px; padding: 14px 20px; }
  .btn-pop--large { font-size: 18px; }

  .success-card { padding: 28px 20px; }
}

@media (max-width: 420px) {
  .hero-points-preview { gap: 4px; }
  .point-chip { font-size: 10px; padding: 3px 7px; }
  .wallet-input-wrap { flex-direction: column; }
  .ref-link-wrap { flex-direction: column; }
  .ref-link-display { border-right: 2px solid var(--fg); border-bottom: none; }
}
