@font-face {
  font-family: "BalooWord";
  src: url("vendor/fonts/baloo2-word.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --ink: #0f2547;
  --muted: #8494ab;
  --ink2: #47617e;
  --bg: #f2f5fa;
  --card: #ffffff;
  --line: #dbe4f0;
  --gold: #dd9500;
  --fast: #0e7a4f;
  --radius: 18px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink); min-height: 100vh;
}
::selection { background: #bfd4fb; }
button { font: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid var(--gold); outline-offset: 2px;
}

/* header (fleet template) */
.app-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { width: 44px; height: 44px; border-radius: 11px; }
.wordmark { font-family: "BalooWord", -apple-system, sans-serif; font-size: 26px; font-weight: 700; line-height: 1; color: var(--ink); letter-spacing: 0.2px; }
.wordmark-ku { color: var(--blue); }
.tagline { font-size: 9.5px; letter-spacing: 0.5px; color: var(--muted); margin-top: 3px; font-weight: 600; line-height: 1.28; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.lang-toggle { display: flex; background: #e8eef7; border-radius: 999px; padding: 2px; }
.lang-btn { border: 0; background: transparent; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--muted); min-height: 28px; }
.lang-btn.lang-active { background: var(--blue); color: #fff; box-shadow: 0 1px 3px rgba(15, 37, 71, 0.18); }
.version-badge { font-size: 12px; font-weight: 600; color: var(--blue); background: #e3ecfd; padding: 5px 10px; border-radius: 999px; }

.container { max-width: 560px; margin: 0 auto; padding: 18px 16px 28px; }
.group-label { font-size: 13px; font-weight: 700; letter-spacing: 0.4px; color: var(--muted); margin: 16px 2px 8px; text-transform: uppercase; }

/* hero (fleet template + crescent) */
.hero-card {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  border-radius: 20px; padding: 22px 20px; color: #fff;
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.32);
}
.hero-card::after {
  content: ""; position: absolute; right: -46px; top: -46px;
  width: 170px; height: 170px; border-radius: 50%;
  border: 26px solid rgba(255, 255, 255, 0.14);
}
.hero-hijri { position: relative; z-index: 1; font-size: 27px; font-weight: 800; letter-spacing: -0.01em; max-width: 78%; line-height: 1.2; }
.hero-greg { position: relative; z-index: 1; font-size: 15px; opacity: 0.88; margin-top: 3px; }
.hero-fast {
  position: relative; z-index: 1; display: inline-block; margin-top: 14px;
  background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px; padding: 6px 12px; font-size: 13.5px; font-weight: 700;
}
.hero-moon { position: absolute; z-index: 1; right: 14px; top: 10px; width: 88px; height: 88px; opacity: 0.95; pointer-events: none; }

/* cards & buttons (fleet template) */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: 0 2px 8px rgba(15, 37, 71, 0.05), 0 10px 22px rgba(15, 37, 71, 0.05);
}
.btn { border: 0; border-radius: 14px; padding: 13px 18px; font-size: 15.5px; font-weight: 600; text-align: center; min-height: 48px; }
.btn-secondary { background: #e8eef7; color: var(--ink); }
.btn-block { width: 100%; margin-top: 14px; }
.summary-box {
  background: #eef4ff; border: 1px solid #d3e0fb; border-radius: 14px;
  padding: 13px 15px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 1px;
}
.nf-label, .cd-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px; color: var(--blue-dark); }
.nf-name, .cd-big { font-size: 19px; font-weight: 800; color: var(--ink); }
.nf-when, .cd-date { font-size: 13.5px; font-weight: 600; color: var(--ink2); }
.list-card { padding: 6px 16px; }
.frow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 2px; border-top: 1px solid var(--line); }
.frow:first-child { border-top: none; }
.frow-name { font-size: 15.5px; font-weight: 700; }
.frow-sub { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 1px; }
.frow-greg { font-size: 13.5px; font-weight: 700; color: var(--blue); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-title { text-align: center; }
.cal-month { font-family: "BalooWord", -apple-system, sans-serif; font-size: 22px; font-weight: 700; }
.cal-sub { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 1px; }
.cal-nav {
  width: 42px; height: 42px; border-radius: 50%; border: 1.5px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 21px; font-weight: 700; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); margin-top: 14px; }
.cal-week span { text-align: center; font-size: 11.5px; font-weight: 800; color: var(--muted); padding: 4px 0; text-transform: uppercase; letter-spacing: 0.4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 4px; }
.cell {
  position: relative; min-height: 54px; border: 1.5px solid #e6edf6; border-radius: 14px;
  background: #fff; color: var(--ink); display: flex; flex-direction: column; align-items: center;
  padding: 6px 0 5px;
}
.cell.empty { background: transparent; border-color: transparent; }
.cell .dnum { font-size: 16.5px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.cell .gnum { font-size: 10.5px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.25; }
.cell .dots { display: flex; gap: 3px; height: 7px; margin-top: 2px; }
.cell.has-fast { background: #e9f7ef; border-color: #cdeeda; }
.cell.has-hol { background: #fdf6dd; border-color: #f0e2ae; }
.cell.has-forbid { background: #fdecea; border-color: #f3cdc8; }
.cell.today { background: linear-gradient(135deg, #1d4ed8, #2563eb); border-color: var(--blue-dark); box-shadow: 0 6px 14px rgba(37, 99, 235, 0.35); }
.cell.today .dnum { color: #fff; }
.cell.today .gnum { color: #cfdefc; }
.cell.sel { border-color: var(--blue); box-shadow: 0 0 0 2px #bfd4fb; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-fast { background: var(--fast); }
.dot-holiday { background: var(--gold); }
.dot-forbid { background: #c93a30; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; }
.cal-legend .lg { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink2); }

/* day detail */
.day-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.day-hijri { font-family: "BalooWord", -apple-system, sans-serif; font-size: 21px; font-weight: 700; }
.day-greg { font-size: 13.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.day-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.tag { font-size: 13px; font-weight: 700; border-radius: 999px; padding: 6px 11px; }
.tag-fast { background: #e2f3ea; color: #0a5c39; }
.tag-holiday { background: #fdf3d3; color: #8a5c00; }
.tag-forbid { background: #fbe7e4; color: #8f271f; }
.tag-none { background: #eef2f8; color: var(--ink2); }

/* converter */
.seg-row { display: flex; gap: 8px; margin-bottom: 6px; }
.seg-btn {
  flex: 1; border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 14px; padding: 12px 6px; font-weight: 700; font-size: 14px; min-height: 48px;
}
.seg-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 6px 14px rgba(37, 99, 235, 0.28); }
.field { display: block; margin-top: 10px; }
.field > span { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.txt {
  font: inherit; font-size: 16px; font-weight: 600; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px; background: var(--card);
  min-height: 48px; width: 100%;
}
.hrow { display: flex; gap: 9px; }
.hrow .field { flex: 0 0 76px; margin-top: 10px; }
.hrow .field.grow { flex: 1; }
.conv-result {
  margin-top: 14px; background: #f2f6fd; border: 1.5px dashed #b9cdf3; border-radius: 14px;
  padding: 14px; font-size: 18px; font-weight: 800; text-align: center;
}

/* footer (fleet template) */
.dev-footer { margin-top: 30px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.dev-by { position: relative; font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; padding: 13px 18px; }
.dev-credit { display: inline-flex; align-items: center; gap: 4px; color: var(--blue); font-weight: 700; text-decoration: none; }
.dev-credit svg { color: var(--blue); flex: none; }
.credit-beetle { color: var(--blue); display: inline-flex; vertical-align: -2px; }
.about-toggle { background: none; border: 0; padding: 6px 10px; font: inherit; font-size: 12.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--muted); cursor: pointer; min-height: 36px; }

/* about sheet */
.overlay {
  position: fixed; inset: 0; background: rgba(10, 35, 32, 0.5);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
}
.sheet {
  background: var(--card); border-radius: 22px 22px 0 0; width: 100%; max-width: 560px;
  padding: 18px 18px 30px; max-height: 82vh; overflow: auto;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sheet-title { font-family: "BalooWord", -apple-system, sans-serif; font-size: 20px; font-weight: 700; }
.sheet-p { font-size: 14.5px; line-height: 1.55; color: var(--ink); margin-top: 10px; }
.credit-line { font-weight: 700; }

@media (min-width: 560px) {
  .cell { min-height: 60px; }
  .hero-hijri { font-size: 30px; }
}

/* holidays highlight */
.countdown-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  border-radius: 20px; padding: 18px 20px; color: #fff;
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.32);
  margin-bottom: 10px; display: flex; flex-direction: column; gap: 1px;
}
.countdown-hero::after {
  content: ""; position: absolute; right: -40px; top: -40px;
  width: 140px; height: 140px; border-radius: 50%;
  border: 22px solid rgba(255, 255, 255, 0.14);
}
.countdown-hero .cd-label { color: #bfd4fb; }
.countdown-hero .cd-big { color: #fff; font-size: 26px; }
.countdown-hero .cd-date { color: #dbe7fd; }
.countdown-hero .cd-note { position: relative; z-index: 1; margin-top: 8px; font-size: 12.5px; font-weight: 700; color: #ffe9a8; }
.frow.next { background: #fdf6dd; border: 1.5px solid #f0e2ae; border-radius: 14px; padding: 11px 10px; margin: 6px -6px 2px; border-top: 1.5px solid #f0e2ae; }
.next-badge { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; background: var(--gold); color: #fff; border-radius: 999px; padding: 3px 8px; vertical-align: 2px; }
.date-pill { background: #e3ecfd; color: var(--blue-dark); font-size: 13px; font-weight: 700; border-radius: 999px; padding: 6px 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.beetle-walker { position: absolute; left: 4%; top: 88%; width: 15px; height: 15px; color: #2563eb; pointer-events: none; animation: beetle-walk 11s linear infinite; }
.beetle-walker svg { display: block; }
@keyframes beetle-walk {
  0% { left: 4%; top: 88%; transform: translate(-50%, -50%) rotate(-180deg); }
  7% { left: 4%; top: 88%; transform: translate(-50%, -50%) rotate(-270deg); }
  38% { left: 96%; top: 88%; transform: translate(-50%, -50%) rotate(-270deg); }
  47% { left: 96%; top: 12%; transform: translate(-50%, -50%) rotate(-360deg); }
  78% { left: 4%; top: 12%; transform: translate(-50%, -50%) rotate(-450deg); }
  87% { left: 4%; top: 88%; transform: translate(-50%, -50%) rotate(-540deg); }
  100% { left: 4%; top: 88%; transform: translate(-50%, -50%) rotate(-540deg); }
}
@media (prefers-reduced-motion: reduce) { .beetle-walker { animation: none; display: none; } }
