:root {
  color-scheme: dark;
  --bg: #0d1320;
  --panel: #172033;
  --panel-2: #1c2740;
  --border: #2c3a58;
  --text: #f3f6fb;
  --muted: #aebad0;
  --accent: #78b8ff;
  --input: #fff0a8;
  --input-text: #231f12;
  --good: #56d69a;
  --warn: #ffd166;
  --danger: #ff7a7a;
  --shadow: 0 18px 60px rgba(0,0,0,.24);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #182744 0, var(--bg) 38rem);
  color: var(--text);
}
button, input, select { font: inherit; }
button, select, input { touch-action: manipulation; }

.page-shell {
  width: min(1100px, calc(100% - 24px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.hero {
  padding: 22px 4px 18px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: .83rem;
  font-weight: 750;
  letter-spacing: .04em;
}
h1 {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 3rem);
  line-height: 1.05;
}
.subtitle {
  max-width: 780px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.status {
  margin: 0 0 14px;
  padding: 11px 14px;
  border: 1px solid;
  border-radius: 12px;
  font-weight: 700;
}
.status-ok { color: #b9f6dc; background: rgba(58,180,124,.11); border-color: rgba(86,214,154,.42); }
.status-error { color: #ffd1d1; background: rgba(220,75,75,.13); border-color: rgba(255,122,122,.48); }

.calculator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(330px, .95fr);
  gap: 14px;
  align-items: start;
}
.card {
  background: linear-gradient(180deg, rgba(28,39,64,.98), rgba(23,32,51,.98));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
}
.card h2 { margin: 0; font-size: 1.2rem; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hint { margin: 8px 0 6px; color: var(--muted); font-size: .92rem; }
.storage-note { margin: 0 0 16px; color: #91a3bf; font-size: .78rem; line-height: 1.4; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > span { color: #dce5f5; font-size: .9rem; font-weight: 650; }
.field small { color: var(--muted); font-size: .76rem; }
input, select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 2px solid transparent;
  border-radius: 11px;
  outline: none;
  background: var(--input);
  color: var(--input-text);
  font-weight: 760;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(120,184,255,.16); }
.inline-input { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px; }
.mini-button, .text-button {
  border: 0;
  cursor: pointer;
  font-weight: 700;
}
.mini-button {
  min-height: 48px;
  padding: 0 12px;
  border-radius: 11px;
  color: #dceaff;
  background: #293c61;
}
.text-button { padding: 6px; color: var(--accent); background: transparent; }
.fixed-field {
  padding: 9px 12px;
  min-height: 78px;
  justify-content: center;
  border: 1px dashed #455677;
  border-radius: 11px;
  background: rgba(255,255,255,.025);
}
.fixed-field strong { font-size: 1.05rem; }

.results-card { position: sticky; top: 10px; }
.results-list { margin-top: 14px; display: grid; gap: 8px; }
.result-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 11px 12px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 11px;
}
.result-row span { color: #d2dced; font-size: .91rem; }
.result-row strong { font-size: 1.08rem; text-align: right; }
.subtle-result { opacity: .85; }
.main-result { border-color: rgba(86,214,154,.42); background: rgba(86,214,154,.09); }
.main-result strong { color: #8af0bf; font-size: 1.3rem; }
.warning-result { border-color: rgba(255,209,102,.45); background: rgba(255,209,102,.1); }
.warning-result strong { color: var(--warn); font-size: 1.32rem; }

.schedule-box { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.schedule-box summary { color: var(--accent); cursor: pointer; font-weight: 700; }
.schedule-content { margin-top: 10px; color: var(--muted); line-height: 1.55; font-size: .9rem; }
.schedule-chip { display: inline-block; margin: 4px 5px 0 0; padding: 5px 8px; border-radius: 999px; background: #273754; color: #e4ecf9; }

.info-card, .help-card { margin-top: 14px; }
.info-card p { margin: 12px 0 0; color: #d4ddec; line-height: 1.55; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 14px; }
figure { margin: 0; min-width: 0; }
figure img { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--border); }
figcaption { margin-top: 9px; color: var(--muted); line-height: 1.5; font-size: .88rem; }
footer { padding: 18px 4px 0; color: #8190ab; font-size: .82rem; text-align: center; }

@media (max-width: 780px) {
  body { background: var(--bg); }
  .page-shell { width: min(100% - 12px, 680px); padding-top: 4px; padding-bottom: 28px; }
  .hero { padding: 12px 4px 10px; }
  h1 { font-size: clamp(1.55rem, 8vw, 2.2rem); }
  .subtitle { margin-top: 8px; font-size: .9rem; line-height: 1.42; }
  .eyebrow { margin-bottom: 6px; font-size: .75rem; }
  .status { margin-bottom: 8px; padding: 8px 10px; border-radius: 10px; font-size: .86rem; }
  .calculator-grid { grid-template-columns: 1fr; gap: 8px; }
  .results-card { position: static; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .current-time-field { grid-column: 1 / -1; }
  .help-grid { grid-template-columns: 1fr; }
  .card { padding: 13px; border-radius: 13px; box-shadow: none; }
  .card h2 { font-size: 1.08rem; }
  .hint { font-size: .84rem; }
  input, select { min-height: 50px; padding: 9px 10px; border-radius: 10px; }
  .field > span {
    font-size: .82rem;
    line-height: 1.2;
    min-height: 2.4em;
  }
  .current-time-field > span { min-height: auto; }
  .field small { font-size: .7rem; }
  .fixed-field { min-height: 76px; }
  .result-row { padding: 10px; }
  .info-card, .help-card { margin-top: 8px; }
  footer { padding-top: 12px; }
}

@media (max-width: 430px) {
  .page-shell { width: calc(100% - 8px); }
  .form-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .current-time-field { grid-column: 1 / -1; }
  .inline-input { grid-template-columns: minmax(0,1fr) auto; }
  .result-row { grid-template-columns: minmax(0,1fr) auto; gap: 8px; padding: 9px; }
  .result-row span { font-size: .82rem; line-height: 1.2; }
  .result-row strong { font-size: .98rem; }
  .main-result strong, .warning-result strong { font-size: 1.16rem; }
  .schedule-chip { font-size: .82rem; }
}

@media (max-width: 350px) {
  .form-grid { grid-template-columns: 1fr; }
  .current-time-field { grid-column: auto; }
}

/* Language selector */
.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.top-row .eyebrow { margin: 0; }
.language-picker {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 4px 7px 4px 9px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(28,39,64,.9);
  color: var(--accent);
}
.language-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.language-picker select {
  width: auto;
  min-width: 112px;
  min-height: 30px;
  padding: 2px 27px 2px 5px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: .84rem;
  font-weight: 700;
  box-shadow: none;
}
.language-picker select:focus { box-shadow: none; border-color: transparent; }
.language-picker option { background: #172033; color: #f3f6fb; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 520px) {
  .top-row { gap: 8px; align-items: center; }
  .language-picker { min-height: 34px; padding: 2px 5px 2px 7px; gap: 5px; }
  .language-icon { width: 17px; height: 17px; }
  .language-picker select { min-width: 94px; min-height: 28px; padding-right: 22px; font-size: .76rem; }
  .top-row .eyebrow { font-size: .7rem; }
}

@media (max-width: 365px) {
  .top-row { flex-wrap: wrap; }
  .language-picker { margin-left: auto; }
}

.language-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 25px;
  padding: 0 5px;
  border-radius: 7px;
  background: rgba(120,184,255,.14);
  color: var(--accent);
  font-size: .75rem;
  font-weight: 850;
  letter-spacing: .04em;
}
@media (max-width: 520px) {
  .language-code { min-width: 25px; height: 23px; font-size: .7rem; }
}

/* Quick guide above the results */
.result-guide {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid rgba(120,184,255,.35);
  border-radius: 12px;
  background: rgba(120,184,255,.08);
}
.result-guide-icon {
  font-size: 1.2rem;
  line-height: 1.2;
}
.result-guide strong {
  color: #dceaff;
  font-size: .92rem;
}
.result-guide p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.45;
}
.result-guide p strong {
  color: var(--text);
  font-size: inherit;
}

@media (max-width: 780px) {
  .result-guide {
    margin-top: 10px;
    padding: 10px;
    gap: 8px;
  }
  .result-guide p {
    font-size: .8rem;
    line-height: 1.4;
  }
}
