@font-face {
  font-family: "Naskh";
  src: url("/fonts/naskh.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Naskh";
  src: url("/fonts/naskh-bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --paper: #f4f0e8;
  --ink: #1c1915;
  --muted: #5e584f;
  --line: #e4ddd0;
  --white: #fffcf7;
  --green: #12382a;
  --green-mid: #1d6b45;
  --green-soft: #e5f2ea;
  --gold: #c4a15a;
  --amber: #9a5b12;
  --amber-soft: #f8ecd9;
  --danger: #8d2f2f;
  --shadow: 0 10px 30px rgba(18, 56, 42, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: #101412;
  color: var(--ink);
  font-family: "Naskh", "Noto Naskh Arabic", Tahoma, sans-serif;
  font-size: 17px;
  line-height: 1.65;
}

button, input, textarea { font: inherit; color: inherit; }

a { color: inherit; }

.app {
  width: min(100%, 430px);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  position: relative;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 12px;
  background: var(--green);
  color: #f7f3ea;
  position: sticky;
  top: 0;
  z-index: 3;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  min-height: 48px;
}

.brand strong, .brand small { display: block; line-height: 1.2; }
.brand strong { font-size: 1.15rem; font-weight: 700; }
.brand small { color: #d9c48a; font-size: 0.78rem; }

.mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--green) 0 28%, transparent 29%),
    radial-gradient(circle at 50% 50%, #f4f0e8 0 46%, transparent 47%),
    radial-gradient(circle at 50% 50%, var(--gold) 0 62%, transparent 63%),
    var(--green);
  border: 1px solid rgba(226, 194, 122, 0.7);
  flex: none;
}

.board-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-decoration: none;
  color: inherit;
  background: rgba(255, 252, 247, 0.08);
  border: 1px solid rgba(226, 194, 122, 0.35);
  border-radius: 14px;
  padding: 6px 10px;
  min-width: 118px;
  min-height: 48px;
}

.board-btn strong { font-size: 1.05rem; letter-spacing: 0; }
.board-btn span { color: #b7e0c8; font-size: 0.82rem; }

main {
  flex: 1;
  padding: 16px 16px calc(92px + env(safe-area-inset-bottom));
}

.tabs {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-top: auto;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 252, 247, 0.96);
  border-top: 1px solid var(--line);
  z-index: 4;
}

.tabs a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  text-decoration: none;
  color: var(--muted);
  border-radius: 14px;
  font-size: 0.78rem;
}

.tabs a i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid currentColor;
}

.tabs a.active {
  color: var(--green);
  background: var(--green-soft);
  font-weight: 700;
}

.tabs a.active i { background: var(--green); }

.kicker {
  margin: 0;
  color: var(--gold);
  font-size: 0.85rem;
}

.ask {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px 16px 16px;
  box-shadow: var(--shadow);
}

.ask h1 {
  margin: 2px 0 12px;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
}

.ask textarea {
  width: 100%;
  border: 0;
  resize: none;
  min-height: 64px;
  background: transparent;
  outline: none;
  font-size: 1.05rem;
}

.ask textarea:disabled { color: var(--muted); }

.lock {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  background: var(--green);
  color: #f7f3ea;
  margin-bottom: 8px;
  cursor: pointer;
}

.lock.alt {
  background: transparent;
  color: var(--green);
  border: 1px solid var(--green);
}

.ask-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.mic {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 0;
  background: var(--green);
  color: #f7f3ea;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(18, 56, 42, 0.25);
}

.mic:disabled { opacity: 0.45; }

.mic-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: inset 0 0 0 5px var(--green), 0 0 0 2px var(--gold);
}

.sound {
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 999px;
  min-height: 44px;
  padding: 0 14px;
  cursor: pointer;
}

.sound[aria-pressed="true"] {
  background: var(--ink);
  color: var(--white);
  border-color: var(--ink);
}

.place-line, .hint, .fine {
  color: var(--muted);
  font-size: 0.92rem;
}

.place-line { margin: 12px 0 0; }

.reply {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.card, .panel, .wallet-card, .menu {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  margin-top: 14px;
  overflow-x: auto;
}

.wallet-card {
  margin-top: 0;
  background: var(--green);
  color: #f7f3ea;
  border: 0;
}

.wallet-card .kicker { color: var(--gold); }
.coins { display: block; font-size: 1.8rem; line-height: 1.25; }
.wallet-card .fine { color: #d7dece; }

.price-line { font-size: 1.6rem; margin: 4px 0; }

.card h2, .panel h2 { margin: 0 0 8px; font-size: 1.12rem; font-weight: 700; }
.card label { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.card input[inputmode="numeric"] {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  width: 100%;
  background: var(--white);
  font-size: 1rem;
}

.targets { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--paper);
}

.actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.actions button, .primary {
  border: 0;
  background: var(--green);
  color: #f7f3ea;
  border-radius: 14px;
  min-height: 48px;
  padding: 8px 14px;
  cursor: pointer;
}

.actions button.quiet, button.quiet {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--line);
}

table { width: 100%; border-collapse: collapse; font-size: 0.86rem; min-width: 520px; }
th, td { text-align: right; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }

.above { color: var(--danger); }
.inside { color: var(--amber); }
.below { color: var(--green-mid); }

.chart { width: 100%; height: auto; background: var(--white); }
.chart text { font-family: "Naskh", Tahoma, sans-serif; }

.legend { display: flex; gap: 16px; color: var(--muted); font-size: 0.92rem; flex-wrap: wrap; }
.swatch { display: inline-block; width: 18px; height: 4px; margin-inline-end: 6px; vertical-align: middle; }
.swatch.coin { background: var(--green-mid); }
.swatch.toman { background: var(--amber); }

.sliders label { display: block; margin-top: 8px; color: var(--muted); }
.sliders input[type="range"] { width: 100%; }

.open { padding-inline-start: 18px; }
.open li { margin-bottom: 8px; }

.menu { margin-top: 0; padding: 8px; display: flex; flex-direction: column; }
.menu a {
  text-decoration: none;
  min-height: 56px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 14px;
}
.menu a + a { border-top: 1px solid var(--line); border-radius: 0; }
.menu a:active { background: var(--green-soft); }

.back {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  text-decoration: none;
  color: var(--green-mid);
  margin-bottom: 8px;
}

code {
  font-family: "DejaVu Sans Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  direction: ltr;
  unicode-bidi: isolate;
}

.quote {
  background: var(--paper);
  border-radius: 12px;
  padding: 8px 10px;
  margin: 6px 0;
}

.absent { background: var(--amber-soft); }
.unconfirmed { color: var(--amber); }
