/* رنگ‌ها همه از تم انتخابی میان (theme.js متغیرهای --bg, --card, --hero-g, --t0-g ... رو ست می‌کنه).
   فونت: فونت خودِ دستگاه (مثل اپ شیفت) - هیچ فایل فونتی دانلود نمی‌شه، پس اپ سریع‌تر باز می‌شه. */
:root {
  --bg: #E1EFEB; --card: #F6FAF9; --border: #C0DFD5; --text: #1B2230; --muted: #667085; --accent: #047D58;
  --radius: 10px;
  --hero-g: linear-gradient(135deg, #E5484D, #E9676B);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Vazirmatn', Tahoma, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease;
}
button { font: inherit; color: inherit; }

main {
  max-width: 1100px; margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) clamp(14px, 3vw, 40px) calc(28px + env(safe-area-inset-bottom));
}

/* --- بنر بالا (مثل hero اپ شیفت) --- */
.hero {
  position: sticky; top: calc(6px + env(safe-area-inset-top)); z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: 14px 14px; margin-bottom: 14px;
  background: var(--hero-g); color: #fff;
  border-radius: calc(var(--radius) + 6px);
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.titles { flex: 1; min-width: 0; }
.hero h1 { margin: 0; font-size: 19px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.updated { margin: 0; font-size: 12px; opacity: .9; }
.icon-btn {
  flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px; border: 0;
  background: rgba(255,255,255,.2); color: #fff; cursor: pointer;
}
.icon-btn:active { background: rgba(255,255,255,.34); }
.icon-btn.spinning svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- دکمه‌های رنگی (مثل کاشی‌های صفحه اصلی اپ شیفت) --- */
.menu { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .menu { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 960px) { .menu { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between;
  gap: 8px; min-height: 108px; padding: 14px;
  border: 0; border-radius: var(--radius); color: #fff; text-align: right; cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,.14);
  transition: transform .08s ease, filter .08s ease;
}
.tile:active { transform: scale(.97); filter: brightness(.95); }
.tile .emoji {
  font-size: 24px; line-height: 1; width: 42px; height: 42px; display: grid; place-items: center;
  background: rgba(255,255,255,.94); border-radius: 12px; box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.tile .label { font-weight: 800; font-size: 15.5px; line-height: 1.35; }
.tile .count { font-size: 12px; opacity: .9; }
.tile .peek {
  font-size: 12px; opacity: .92; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tile.wide { grid-column: 1 / -1; min-height: 76px; flex-direction: row; align-items: center; }
.tile.wide .label { flex: 1; }

/* --- لیست خبرها --- */
.news { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
@media (min-width: 760px) { .news { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.news a {
  display: flex; flex-direction: column; justify-content: space-between; height: 100%;
  padding: 14px 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  border-inline-start: 4px solid var(--sec, var(--accent));
  color: inherit; text-decoration: none;
}
.news a:active { filter: brightness(.96); }
.news .title { margin: 0 0 8px; font-weight: 650; font-size: 15.5px; line-height: 1.75; }
.news .title[dir="ltr"] { text-align: left; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; color: var(--muted); }
.chip { padding: 0 9px; border-radius: 999px; background: var(--sec, var(--accent)); color: #fff; font-weight: 700; }

.rates { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; max-width: 640px; }
.rate-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; }
.rate-row + .rate-row { border-top: 1px solid var(--border); }
.rate-row .value { font-weight: 800; white-space: nowrap; }
.rate-row .unit { font-size: 12px; color: var(--muted); font-weight: 400; margin-inline-start: 5px; }

.empty, .error {
  padding: 28px 16px; text-align: center; color: var(--muted);
  background: var(--card); border: 1px dashed var(--border); border-radius: var(--radius);
}
.error { grid-column: 1 / -1; }

.install {
  margin-top: 14px; padding: 14px 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.install p { margin: 0; flex: 1 1 100%; font-size: 13.5px; }
.install-btn { border: 0; border-radius: 12px; padding: 8px 18px; cursor: pointer; background: var(--accent); color: #fff; font-weight: 800; }
.link-btn { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 8px; }

.report-link {
  display: block; margin-top: 16px; padding: 14px; text-align: center;
  color: var(--text); text-decoration: none; font-size: 14px;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--card);
}

/* --- انتخاب تم (کپی از ThemePicker اپ شیفت: نوار شیشه‌ای پایین + قاب طلایی) --- */
.picker { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.picker-frame {
  position: fixed; inset: 0; border-radius: 26px; padding: 4px;
  background: linear-gradient(90deg, #B8860B, #F7D774, #FFF4C2, #E0A800, #B8860B, #F7D774, #B8860B) 0 0 / 300% 100%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  filter: drop-shadow(0 0 6px rgba(247,215,116,.8)); animation: frame-shine 6s linear infinite;
}
@keyframes frame-shine { to { background-position: 300% 0; } }
.picker-bar {
  pointer-events: auto; position: fixed; left: 50%; transform: translateX(-50%);
  bottom: max(14px, calc(env(safe-area-inset-bottom) + 8px));
  width: min(520px, calc(100% - 24px)); padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
  background: color-mix(in srgb, var(--card) 72%, transparent);
  backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border: 1.5px solid rgba(232,190,80,.85); border-radius: 22px; box-shadow: 0 8px 28px rgba(0,0,0,.25);
}
.picker-row { display: flex; align-items: center; gap: 6px; }
.pill { height: 40px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-weight: 700; cursor: pointer; flex: none; }
.pill.main { border: 0; background: var(--accent); color: #fff; font-weight: 800; }
.arrow { width: 40px; height: 40px; border-radius: 14px; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.pk-name-wrap { flex: 1; min-width: 0; text-align: center; }
.pk-name { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: name-pop .35s ease-out; }
@keyframes name-pop { 0% { transform: scale(.8); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: none; } }
.pk-count { font-size: 11px; color: var(--muted); }
.seg { display: flex; gap: 3px; padding: 3px; border-radius: 12px; background: color-mix(in srgb, var(--bg) 80%, transparent); border: 1px solid var(--border); }
.seg button { flex: 1; padding: 6px 8px; border-radius: 9px; border: 0; background: transparent; cursor: pointer; font-size: 13px; font-weight: 600; }
.seg button.on { background: var(--card); font-weight: 800; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.pk-hint { margin: 0; text-align: center; font-size: 11px; color: var(--muted); }
.sweep {
  position: fixed; inset: -10% -20%; z-index: 49; pointer-events: none;
  background: linear-gradient(90deg, transparent 15%, rgba(255,255,255,.3) 35%, rgba(255,255,255,.75) 50%, rgba(255,255,255,.3) 65%, transparent 85%);
  animation: sweep .6s cubic-bezier(.4,0,.2,1) forwards;
}
.sweep.back { animation-name: sweep-back; }
@keyframes sweep { from { transform: translateX(-110%) skewX(-12deg); } to { transform: translateX(110%) skewX(-12deg); } }
@keyframes sweep-back { from { transform: translateX(110%) skewX(-12deg); } to { transform: translateX(-110%) skewX(-12deg); } }
body.picking main { padding-bottom: 170px; }
@media (prefers-reduced-motion: reduce) { .pk-name, .picker-frame, .sweep { animation: none; } .sweep { display: none; } }

/* --- صفحه اصلی: ساعت، آب‌وهوا، قیمت‌ها --- */
:root { --up: #15803D; --down: #C0392B; }
:root[data-mode="dark"] { --up: #4ADE80; --down: #F87171; }
.home-top { display: grid; gap: 12px; margin-bottom: 12px; }
@media (min-width: 900px) { .home-top { grid-template-columns: 1fr 1fr; align-items: stretch; } }
.home-col { display: flex; flex-direction: column; min-width: 0; }
.row-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 4px 2px 8px; font-weight: 800; font-size: 15px; }
.row-title a, .row-link { font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; }

/* درخشش آرومی که هر چند ثانیه از روی کارت رد می‌شه (sp-shine اپ شیفت) */
.shine, .wx { position: relative; }
.shine-layer { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; }
.shine-layer::after {
  content: ""; position: absolute; top: -30%; bottom: -30%; left: 0; width: 34%;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.08) 28%, rgba(255,255,255,.3) 50%, rgba(255,255,255,.08) 72%, transparent 100%);
  transform: translateX(-260%) skewX(-18deg);
  animation: shine 11s cubic-bezier(.45,.05,.35,1) var(--shine-delay, 1.5s) infinite;
}
@keyframes shine { 0%, 76% { transform: translateX(-260%) skewX(-18deg); } 100% { transform: translateX(560%) skewX(-18deg); } }

.clock-card {
  background: var(--clock-g); color: #fff; border-radius: calc(var(--radius) + 4px);
  padding: 14px 12px 10px; box-shadow: 0 6px 14px rgba(0,0,0,.18);
  display: flex; flex-direction: column; justify-content: center; --shine-delay: .6s;
}
.clock-pair { display: flex; align-items: center; gap: 8px; }
.clock { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.clock .analog { flex: none; }
.clock-text { min-width: 0; }
.clock-city { font-size: 12.5px; font-weight: 800; opacity: .9; }
.clock-digital { font-size: 20px; font-weight: 800; line-height: 1.25; font-variant-numeric: tabular-nums; white-space: nowrap; }
.clock-date { font-size: 11px; opacity: .88; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clock-sep { width: 1px; align-self: stretch; background: rgba(255,255,255,.3); }
.clock-diff { margin-top: 8px; text-align: center; font-size: 11.5px; opacity: .85; }
@media (max-width: 380px) { .clock .analog { width: 46px; height: 46px; } .clock-digital { font-size: 17px; } }

.wx-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; flex: 1; }
.wx {
  display: flex; flex-direction: column; justify-content: space-between; gap: 2px; min-height: 108px;
  padding: 10px 11px; border-radius: var(--radius); color: #fff; text-decoration: none;
  box-shadow: 0 4px 10px rgba(0,0,0,.14); --shine-delay: 2.4s;
}
.wx:active { transform: scale(.97); }
.wx-loading { background: var(--card); color: var(--muted); border: 1px solid var(--border); box-shadow: none; align-items: center; justify-content: center; }
.wx-top { display: flex; justify-content: space-between; align-items: center; }
.wx-city { font-weight: 800; font-size: 13.5px; }
.wx-emoji { font-size: 24px; line-height: 1; }
.wx-temp { font-size: 30px; font-weight: 800; line-height: 1.1; }
.wx-range { font-size: 11.5px; opacity: .92; white-space: nowrap; }

.prices-card {
  display: block; margin-bottom: 14px; padding: 12px 14px 6px;
  background: var(--card); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px);
  color: inherit; text-decoration: none;
}
.prices-card .row-title { margin: 0 0 4px; }
.px-list { display: grid; }
@media (min-width: 760px) { .px-list { grid-template-columns: 1fr 1fr; column-gap: 24px; } }
.px { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.px-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.px-val { text-align: left; white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.35; }
.px-val b { font-size: 15px; font-variant-numeric: tabular-nums; }
.px-val .unit { display: none; }
.px .spark { display: block; }
.chg { font-size: 11px; font-weight: 800; padding: 0 6px; border-radius: 999px; }
.chg.up { color: var(--up); background: color-mix(in srgb, var(--up) 14%, transparent); }
.chg.down { color: var(--down); background: color-mix(in srgb, var(--down) 14%, transparent); }
.chg.flat { color: var(--muted); }
.px.big { padding: 14px 16px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; }
.px.big .px-name { font-size: 15px; white-space: normal; line-height: 1.5; }
.px.big .px-val b { font-size: 18px; }
.px.big .px-val .unit { display: inline; font-size: 11px; color: var(--muted); }
.px.big .spark { width: 100px; height: 34px; }
.sub-title { margin: 18px 2px 8px; font-size: 14px; font-weight: 800; color: var(--muted); }

/* صفحه‌ی پیش‌بینی آب‌وهوا */
.wx-pages { display: grid; gap: 12px; }
@media (min-width: 900px) { .wx-pages { grid-template-columns: repeat(3, 1fr); } }
.wx-page { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.wx-head { color: #fff; padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.wx-cond { font-size: 12.5px; opacity: .9; }
.wx-big { font-size: 30px; font-weight: 800; white-space: nowrap; }
.wx-facts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; opacity: .92; }
.wx-days { padding: 4px 14px 8px; }
.wx-day { display: grid; grid-template-columns: 1fr 32px 56px auto; align-items: center; gap: 6px; padding: 8px 0; font-size: 13.5px; }
.wx-day + .wx-day { border-top: 1px solid var(--border); }
.wx-day-emoji { font-size: 20px; text-align: center; }
.wx-day-rain { font-size: 11.5px; color: var(--muted); }
.wx-day-temp { white-space: nowrap; color: var(--muted); }
.wx-day-temp b { color: var(--text); }
.note { margin: 12px 2px; font-size: 11.5px; color: var(--muted); }

.badge-new { display: inline-block; padding: 0 7px; border-radius: 999px; background: var(--accent2, #F59F00); color: #fff; font-size: 11px; font-weight: 800; }
.tile .new-count { position: absolute; top: 10px; left: 10px; background: rgba(255,255,255,.95); color: #1B2230; font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 999px; }
.version { margin: 14px 0 0; text-align: center; font-size: 11px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .shine-layer::after { animation: none; display: none; } }
