:root {
  --orange: #f97316;
  --orange-deep: #ea580c;
  --cream: #faf8f3;
  --peach: #fff7ed;
  --shell: #f1f5f9;
  --ink: #1e293b;
  --muted: #64748b;
  --card: #ffffff;
  --radius: 16px;
  --shadow: 0 24px 50px rgba(15, 23, 42, 0.08);
  --font: "DM Sans", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, var(--peach) 0%, var(--shell) 40%);
}

.shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 16px 24px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 4px 12px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(249, 115, 22, 0.35);
}

.brand-title {
  margin: 0;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.brand-sub {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.coins-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow);
  font-weight: 700;
  color: var(--orange-deep);
}

.panel {
  flex: 1;
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 24px 20px 28px;
}

.view h1,
.view h2 {
  margin: 0 0 8px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.view h1 {
  font-size: 1.6rem;
  color: var(--orange-deep);
}

.lead {
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 20px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.field input {
  font: inherit;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: var(--cream);
  color: var(--ink);
}

.field input:focus {
  outline: 2px solid rgba(249, 115, 22, 0.35);
  border-color: var(--orange);
}

.btn {
  font: inherit;
  font-weight: 700;
  border: none;
  border-radius: 14px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--orange), var(--orange-deep));
  color: #fff;
}

.btn-outline {
  background: var(--peach);
  color: var(--orange-deep);
  border: 1px solid rgba(249, 115, 22, 0.25);
  width: 100%;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  width: 100%;
  margin-top: 8px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--orange-deep);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  font: inherit;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.error {
  color: #dc2626;
  font-size: 0.9rem;
  margin: 0;
}

.success {
  color: #059669;
  font-size: 0.9rem;
  margin: 0;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.hint {
  text-align: center;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  background: var(--cream);
  padding: 4px;
  border-radius: 14px;
}

.tab {
  flex: 1;
  border: none;
  background: transparent;
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 10px 8px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--muted);
}

.tab.active {
  background: var(--card);
  color: var(--orange-deep);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.card {
  background: var(--cream);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.card h2 {
  font-size: 1rem;
  margin: 0 0 10px;
}

.coins-big {
  font-size: 2rem;
  font-weight: 800;
  color: var(--orange-deep);
  margin: 0 0 8px;
}

.market-grid {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.market-card {
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  padding: 16px;
  background: var(--cream);
  display: grid;
  gap: 8px;
}

.market-card header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.market-card h3 {
  margin: 0;
  font-size: 1rem;
}

.market-card .badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--peach);
  color: var(--orange-deep);
}

.market-card .cost {
  font-weight: 800;
  color: var(--orange-deep);
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-list li {
  padding: 14px;
  border-radius: 12px;
  background: var(--cream);
  font-size: 0.9rem;
}

.history-list .status {
  font-weight: 700;
  text-transform: capitalize;
}

.history-list .status.pending {
  color: #d97706;
}

.history-list .status.completed {
  color: #059669;
}

.modal {
  border: none;
  border-radius: 20px;
  padding: 0;
  max-width: 400px;
  width: calc(100% - 32px);
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.2);
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.modal form {
  padding: 22px;
}

.modal h3 {
  margin: 0 0 8px;
}

.redeem-cost {
  margin: 12px 0;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 100;
  max-width: 90vw;
  text-align: center;
}

.site-footer {
  text-align: center;
  padding: 16px 8px 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.site-footer p {
  margin: 0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --cream: #2f3038;
    --peach: #34353f;
    --shell: #1e1f26;
    --card: #282930;
    --ink: #f1f5f9;
    --muted: #94a3b8;
    --shadow: 0 24px 50px rgba(0, 0, 0, 0.35);
  }

  body {
    background: linear-gradient(180deg, #252422 0%, var(--shell) 50%);
  }

  .field input {
    background: var(--peach);
    border-color: #3f4250;
  }
}
