:root {
  --primary: #0758b7;
  --primary-dark: #063f82;
  --primary-soft: #eaf4ff;
  --surface: #ffffff;
  --background: #f4f9ff;
  --text: #12233b;
  --muted: #617188;
  --border: #dbe6f2;
  --success: #138a52;
  --success-soft: #e9f8f0;
  --danger: #b62e28;
  --danger-soft: #fff0ee;
  --shadow: 0 12px 34px rgba(18, 54, 93, 0.09);
  color: var(--text);
  background: var(--background);
  font-family: Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  direction: rtl;
  background:
    radial-gradient(circle at 50% -80px, rgba(7, 88, 183, 0.13), transparent 330px),
    linear-gradient(180deg, #eef7ff 0, #ffffff 470px);
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid rgba(7, 88, 183, 0.25);
  outline-offset: 3px;
}

[hidden] { display: none !important; }
.page-shell { width: calc(100% - 28px); max-width: 680px; margin: 0 auto; }
.site-header { padding: 28px 3px 24px; text-align: center; }
.brand-logo {
  display: block;
  width: min(156px, 42vw);
  height: auto;
  margin: 0 auto 14px;
  border-radius: 12px;
  object-fit: contain;
}
.kicker { margin: 0 0 8px; color: var(--primary); font-size: 0.75rem; font-weight: 700; }
h1 { margin: 0; font-size: clamp(1.9rem, 9vw, 2.65rem); line-height: 1.35; letter-spacing: -0.02em; }
.intro { max-width: 520px; margin: 9px auto 0; color: var(--muted); font-size: 0.95rem; line-height: 1.8; }

.calculator-card, .result-card {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.card-heading { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 20px; }
.heading-icon {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  height: 34px;
  background: var(--primary-soft);
  border-radius: 10px;
  font-size: 1.05rem;
}
.card-heading h2, .result-heading h2 { margin: 0; font-size: 1.08rem; line-height: 1.5; }
.card-heading p { margin: 3px 0 0; color: var(--muted); font-size: 0.79rem; line-height: 1.6; }
form { display: grid; gap: 19px; }
.field-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.field-group legend, .time-field > span { margin-bottom: 9px; color: var(--text); font-size: 0.88rem; font-weight: 700; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.choice-card { position: relative; cursor: pointer; }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card > span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 62px;
  padding: 11px;
  color: var(--muted);
  background: #fbfdff;
  border: 1px solid var(--border);
  border-radius: 13px;
  transition: 0.15s ease;
}
.choice-card b { font-size: 1.25rem; }
.choice-card strong { font-size: 0.91rem; }
.choice-card input:checked + span {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 7px 16px rgba(7, 88, 183, 0.18);
}
.choice-card input:focus-visible + span { outline: 3px solid rgba(7, 88, 183, 0.22); outline-offset: 3px; }
.time-field { display: grid; }
.time-field input {
  width: 100%;
  min-height: 56px;
  padding: 10px 14px;
  color: var(--text);
  background: #fbfdff;
  border: 1px solid #cbd9e8;
  border-radius: 13px;
  direction: ltr;
  text-align: center;
  font-size: 1.14rem;
  font-weight: 700;
}
.time-field input:focus { border-color: var(--primary); }
.time-field small { margin-top: 6px; color: var(--muted); font-size: 0.7rem; }
.form-message {
  margin: -6px 0 0;
  padding: 11px 13px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #f2c1bc;
  border-radius: 11px;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.6;
}
.primary-button, .secondary-button, .permission-button, .community-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 10px 18px;
  border-radius: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.primary-button { gap: 10px; color: #fff; background: var(--primary); border: 0; box-shadow: 0 8px 18px rgba(7, 88, 183, 0.22); }
.primary-button:hover { background: var(--primary-dark); }

.result-section { margin-top: 22px; scroll-margin-top: 16px; }
.result-card { padding: 20px; border-color: #c9dff5; }
.result-heading { padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.result-heading p { margin: 0 0 3px; color: var(--primary); font-size: 0.73rem; font-weight: 700; }
.result-list { display: grid; gap: 0; margin: 4px 0 0; }
.result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 12px 0;
  border-bottom: 1px solid #edf2f7;
}
.result-row dt { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.result-row dd { margin: 0; direction: rtl; color: var(--text); font-size: 1rem; font-weight: 800; text-align: left; }
.remaining-row dd { color: var(--success); }
.schedule-badge {
  width: fit-content;
  margin: 16px auto 0;
  padding: 7px 12px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 1px solid #c9dff5;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 700;
}
.result-actions { display: grid; gap: 10px; margin-top: 13px; }
.secondary-button { color: var(--primary); background: #fff; border: 1px solid var(--primary); }
.permission-button { color: #fff; background: var(--primary); border: 1px solid var(--primary); }
.secondary-button:hover { background: var(--primary-soft); }
.permission-button:hover, .community-button:hover { background: var(--primary-dark); }
.community-card {
  margin-top: 18px;
  padding: 20px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  text-align: center;
}
.community-card h2 { margin: 0; color: var(--text); font-size: 1.05rem; line-height: 1.5; }
.community-card p { margin: 7px auto 0; max-width: 520px; color: var(--muted); font-size: 0.79rem; line-height: 1.75; }
.community-button {
  width: min(100%, 330px);
  margin: 16px auto 0;
  color: #fff;
  background: var(--primary);
  border: 1px solid var(--primary);
  font-size: 0.9rem;
}

footer {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 34px;
  padding: 22px 12px calc(30px + env(safe-area-inset-bottom));
  color: var(--muted);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.65;
}
footer strong { color: var(--text); }
footer p { margin: 5px 0 0; }

@media (min-width: 560px) {
  .site-header { padding-top: 36px; }
  .calculator-card, .result-card { padding: 23px; }
  .result-actions { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .result-section:not([hidden]) { animation: reveal 0.25s ease-out; }
  @keyframes reveal { from { opacity: 0; transform: translateY(8px); } }
}
