* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  min-height: 100vh;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.35s ease;
  padding: 24px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}
body[data-theme="dark"] {
  background: #0B0B0A;
  color: #F5F1E8;
}
body[data-theme="light"] {
  background: #FAF9F6;
  color: #1A1A18;
}

.num { font-family: Georgia, "Times New Roman", serif; font-variant-numeric: lining-nums tabular-nums; font-feature-settings: "lnum" 1, "tnum" 1; }

/* Toggle switch */
.toggle-row {
  position: fixed;
  top: max(24px, env(safe-area-inset-top));
  right: max(24px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  opacity: 0.75;
}
.toggle {
  width: 50px;
  height: 27px;
  border-radius: 14px;
  position: relative;
  cursor: pointer;
  border: none;
  padding: 0;
  transition: background 0.3s ease;
}
body[data-theme="dark"] .toggle { background: #2A2A28; }
body[data-theme="light"] .toggle { background: #DAD7CE; }
.toggle .knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #F5F1E8;
  transition: transform 0.35s cubic-bezier(0.22,0.61,0.36,1);
}
body[data-theme="dark"] .toggle .knob { transform: translateX(0); background: #D4AF6A; }
body[data-theme="light"] .toggle .knob { transform: translateX(23px); background: #1A1A18; }

.card {
  width: 100%;
  max-width: 1100px;
}

.muted { color: #8A867C; }
.accent-dark { color: #D4AF6A; }
.accent-light { color: #9C7A2E; }

.datebar {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-align: center;
  margin-bottom: 3px;
}
.placebar {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-align: center;
  margin-bottom: 42px;
}

.layout {
  display: flex;
  align-items: center;
  gap: 48px;
  flex-direction: column;
}
.now-block { text-align: center; width: 100%; }
.rule-h { height: 1px; width: 40px; margin: 16px auto; }
.rule-v { display: none; }

.now-label { font-size: 11px; letter-spacing: 0.14em; margin-bottom: 10px; }
.now-name { font-size: 32px; margin-bottom: 4px; }
.now-arabic { font-size: 17px; margin-bottom: 20px; }
.next-label { font-size: 10px; letter-spacing: 0.12em; margin-bottom: 8px; }

.count-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-size: 21px;
}
.digit-wrap {
  position: relative;
  display: inline-block;
  width: 13px;
  height: 25px;
  overflow: hidden;
}
.digit-cur {
  position: absolute;
  left: 0; right: 0; top: 0;
  line-height: 25px;
  text-align: center;
}
.letter { line-height: 25px; padding: 0 1px; }

.list-block { width: 100%; }
.rule-top { height: 1px; margin: 24px 0 4px; }
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid;
  font-size: 15px;
  letter-spacing: 0.02em;
}
body[data-theme="dark"] .row { border-color: rgba(255,255,255,0.12); }
body[data-theme="light"] .row { border-color: rgba(0,0,0,0.1); }
.row .dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 9px;
}
.row .dot.empty { background: transparent; }
.row .arabic { font-size: 12px; margin-left: 7px; opacity: 0.75; }
.row .now-tag { font-size: 9px; letter-spacing: 0.08em; margin-left: 8px; opacity: 0.85; }

.credit {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.05em;
  margin-top: 34px;
}
.credit a { text-decoration: underline; color: inherit; }

.error-message {
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
}

@media (min-width: 720px) {
  .layout { flex-direction: row; gap: 72px; }
  .now-block { text-align: left; width: auto; flex: 1; }
  .now-label, .next-label { text-align: left; }
  .count-row { justify-content: flex-start; }
  .rule-h { display: none; }
  .rule-v { display: block; width: 1px; align-self: stretch; }
  .list-block { flex: 1; }
  .now-name { font-size: 44px; }
  .now-arabic { font-size: 19px; margin-bottom: 24px; }
  .count-row { font-size: 22px; }
}

@media (min-width: 1200px) {
  body { padding: 48px; }
  .datebar { font-size: 13px; }
  .placebar { font-size: 13px; margin-bottom: 56px; }
  .layout { gap: 100px; }
  .now-name { font-size: 60px; }
  .now-arabic { font-size: 23px; margin-bottom: 32px; }
  .now-label, .next-label { font-size: 13px; }
  .count-row { font-size: 28px; }
  .digit-wrap { width: 17px; height: 32px; }
  .digit-cur, .letter { line-height: 32px; }
  .row { font-size: 18px; padding: 16px 0; }
  .row .arabic { font-size: 14px; }
  .credit { font-size: 12px; margin-top: 44px; }
}
