/* Doti — stamp-ink indigo, a yellow dot, cool paper */
:root {
  --ink: #17163a;
  --stamp: #2b2bb8;
  --stamp-deep: #1f1f8f;
  --dot: #ffc22e;
  --paper: #f5f6fb;
  --lilac: #e6e6f7;
  --line: #d4d4ea;
  --muted: #5d5c80;
  --white: #ffffff;
  --red: #d6334c;
  --green: #1e9e6a;

  --font-display: 'Baloo Bhaijaan 2', 'Readex Pro', system-ui, sans-serif;
  --font-ui: 'Readex Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --r-pass: 18px;
  --r-field: 12px;
  --r-panel: 22px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
}

img { max-width: 100%; display: block; }

a { color: var(--stamp); }

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.1;
  margin: 0 0 0.4em;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); font-weight: 700; }
h2 { font-size: 1.6rem; font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0 0 1em; }

:focus-visible { outline: 3px solid var(--dot); outline-offset: 2px; border-radius: 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- wordmark: the i's dot is the brand ---------- */
.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.9rem;
  color: var(--stamp);
  text-decoration: none;
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
  direction: ltr;
}
.wordmark .i {
  position: relative;
  display: inline-block;
}
.wordmark .i::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 0.02em;
  width: 0.34em;
  height: 0.34em;
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--dot);
}
/* dotless ı so our yellow dot replaces the real one */
.wordmark.small { font-size: 1.4rem; }
.wordmark.on-dark { color: var(--white); }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 440px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 0;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.8em 1.4em;
  font: 600 1rem var(--font-ui);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  background: var(--stamp);
  color: var(--white);
  transition: transform 0.12s ease, background 0.12s ease;
}
.btn:hover { background: var(--stamp-deep); }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--stamp); box-shadow: inset 0 0 0 2px var(--line); }
.btn.ghost:hover { background: var(--lilac); }
.btn.dot { background: var(--dot); color: var(--ink); }
.btn.dot:hover { background: #ffb400; }
.btn.danger { background: var(--red); }
.btn.small { padding: 0.45em 0.95em; font-size: 0.9rem; }

.lang-toggle {
  appearance: none;
  border: 0;
  background: var(--lilac);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.45em 0.9em;
  font: 600 0.9rem var(--font-ui);
  cursor: pointer;
}

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-weight: 500; font-size: 0.95rem; }
.field small { color: var(--muted); font-size: 0.85rem; }
input, textarea, select {
  width: 100%;
  font: 400 1rem var(--font-ui);
  color: var(--ink);
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: var(--r-field);
  padding: 0.75em 0.9em;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--stamp); }
input[type='color'] { padding: 4px; height: 46px; cursor: pointer; }
input[type='tel'] { direction: ltr; }
[dir='rtl'] input[type='tel'] { text-align: right; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.notice { padding: 12px 14px; border-radius: var(--r-field); background: var(--lilac); margin-bottom: 14px; }
.notice.error { background: #fde7ea; color: #8f1d30; }
.notice.success { background: #e2f5ec; color: #11613f; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ---------- the wallet card (shared by every page) ---------- */
.wcard {
  --c-bg: var(--stamp);
  --c-fg: #ffffff;
  --c-dot: var(--dot);
  background: var(--c-bg);
  color: var(--c-fg);
  border-radius: var(--r-pass);
  padding: 16px 18px 18px;
  box-shadow: 0 18px 40px -18px color-mix(in srgb, var(--c-bg) 80%, black);
  width: 100%;
  max-width: 380px;
  user-select: none;
}
.wcard-head { display: flex; align-items: center; gap: 10px; }
.wcard-logo { width: 38px; height: 38px; border-radius: 10px; object-fit: contain; background: color-mix(in srgb, var(--c-fg) 12%, transparent); }
.wcard-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wcard-count { text-align: end; line-height: 1.1; }
.wcard-count b { font-family: var(--font-display); font-size: 1.6rem; display: block; direction: ltr; }
.wcard-count span { font-size: 0.75rem; color: var(--c-dot); }
.wcard-dots {
  display: grid;
  grid-template-columns: repeat(var(--per-row, 6), 1fr);
  gap: 10px;
  padding: 18px 4px;
  direction: ltr;
}
.wdot {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, var(--c-fg) 45%, transparent);
  display: grid;
  place-items: center;
  max-width: 52px;
  justify-self: center;
  width: 100%;
}
.wdot.filled { background: var(--c-dot); border-color: var(--c-dot); }
.wdot.filled::after {
  content: '';
  width: 32%;
  height: 16%;
  border-left: 3px solid var(--c-bg);
  border-bottom: 3px solid var(--c-bg);
  transform: rotate(-45deg) translate(1px, -1px);
}
.wdot.reward:not(.filled) { border-style: dashed; }
.wdot.reward:not(.filled)::after {
  content: '★';
  color: var(--c-dot);
  font-size: 0.95rem;
  line-height: 1;
}
.wdot.pop { animation: pop 0.45s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes pop { 0% { transform: scale(0.4); } 100% { transform: scale(1); } }
.wcard-foot { display: flex; justify-content: space-between; gap: 12px; font-size: 0.85rem; }
.wcard-foot .label { color: var(--c-dot); font-size: 0.75rem; display: block; }
.wcard-ready {
  margin-top: 12px;
  background: var(--c-dot);
  color: var(--c-bg);
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 700;
  text-align: center;
}

/* ---------- panels ---------- */
.panel { background: var(--white); border-radius: var(--r-panel); padding: 22px; }
.panel + .panel { margin-top: 16px; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--white);
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 500;
  z-index: 50;
  max-width: calc(100% - 32px);
  text-align: center;
}

@media (max-width: 640px) {
  .row, .row3 { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
}
