/* Manták 2027 — jednotný vizuální systém. Logika formulářů zůstává v script.js. */
:root {
  color-scheme: light;
  --page: #f2f5f2;
  --surface: #fff;
  --surface-alt: #eaf1ec;
  --field: #fff;
  --line: #bccac0;
  --text: #17271e;
  --subtle: #54675a;
  --brand: #24583a;
  --brand-hover: #1b472e;
  --brand-soft: #d7e7da;
  --header: #173c29;
  --on-brand: #fff;
  --danger: #af3540;
  --danger-hover: #922a34;
  --warning: #76530e;
  --warning-bg: #fff1d0;
  --focus: #178f64;
  --ring: rgba(23,143,100,.18);
  --shadow: 0 14px 35px rgba(20,53,35,.12);
  --radius: 12px;
  --control-height: 50px;
  --space: 12px;
  font-synthesis: none;
}

body.night {
  color-scheme: dark;
  --page: #101814;
  --surface: #1c2821;
  --surface-alt: #25352b;
  --field: #18241d;
  --line: #526b59;
  --text: #eff7f0;
  --subtle: #b7cbbc;
  --brand: #81c596;
  --brand-hover: #a0d8ae;
  --brand-soft: #2e4936;
  --header: #173824;
  --on-brand: #102318;
  --danger: #f17b83;
  --danger-hover: #ff9a9f;
  --warning: #f4c86c;
  --warning-bg: #483b20;
  --focus: #9adbb0;
  --ring: rgba(154,219,176,.16);
  --shadow: 0 16px 45px rgba(0,0,0,.36);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, body.night {
  background: var(--page);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.45;
  letter-spacing: -.012em;
}
button, input, select { font: inherit; }
button { transition: background-color .16s ease, box-shadow .16s ease, transform .16s ease; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .48; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, [role="button"]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Kompaktní pevná hlavička, s místem pro dva krajní ovladače. */
header, body.night header {
  background: var(--header);
  padding: calc(env(safe-area-inset-top, 0px) + 11px) 16px 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.13);
  width: 100%;
  min-height: 111px;
}
header h1 {
  font-size: clamp(18px, 4.3vw, 23px);
  line-height: 1.25;
  font-weight: 760;
  letter-spacing: .055em;
  text-transform: uppercase;
  padding: 0 42px;
}
.header-content {
  display: grid;
  grid-template-columns: 60px minmax(0,1fr) auto 48px;
  gap: 9px;
  margin-top: 9px;
  min-height: 46px;
}
header #connectionType, header #openVoice {
  position: static;
  width: 100%; height: 46px;
  border-radius: 11px;
  margin: 0;
  background: #fff;
  color: #1b4930;
  border: 1px solid #d3dfd6;
  font-weight: 700;
  box-shadow: 0 2px 7px rgba(0,0,0,.09);
}
header #connectionType { font-size: 15px; padding: 0 6px; text-align: center; }
header #openVoice { font-size: 22px; line-height: 1; }
body.night header #openVoice { background: #f5fcf6; border-color: #ceded1; color: #1b4930; }
header #stats {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: rgba(255,255,255,.11);
  color: #f5fff7;
  border-radius: 9px;
  font-size: clamp(12px,3vw,16px);
  line-height: 1.2;
  padding: 10px 5px;
  align-self: center;
  font-variant-numeric: tabular-nums;
}
header #currentLocator {
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: clamp(12px,2.8vw,15px);
  align-self: center;
  color: #c8e2d0;
  white-space: nowrap;
  font-weight: 700;
}

main {
  max-width: 760px;
  margin: calc(131px + env(safe-area-inset-top, 0px)) auto 32px;
  padding: 0 clamp(12px,3.5vw,24px) 24px;
}
.info-row { margin: 0 0 12px; }
.info-right, body.night .info-right {
  border: 1px solid var(--line);
  background: var(--surface-alt);
  border-radius: var(--radius);
  color: var(--brand);
  min-height: 46px;
  margin: 0;
  padding: 9px 11px;
  font-size: clamp(12px,3.3vw,15px);
  font-variant-numeric: tabular-nums;
  flex-wrap: wrap;
  gap: 5px 10px;
}
.info-label { font-weight: 650; color: var(--subtle); }
#openCompass {
  width: 36px; height: 35px; min-width: 36px;
  padding: 0; margin-left: 4px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: #24583a;
  font-size: 25px; line-height: 1; cursor: pointer;
}
#openCompass:hover { background: #eaf4ec; }
#openCompass svg { display: block; }
.input-row { display: grid; align-items: start; gap: var(--space); margin-bottom: var(--space); }
.input-row:not(.record-fields):not(.note-fields) { grid-template-columns: minmax(0,2fr) minmax(0,1fr); }
.input-row:has(> #mySignal) { grid-template-columns: repeat(4,minmax(0,1fr)) !important; }
.input-row.note-fields, .input-row.record-fields.is-editing { grid-template-columns: repeat(2,minmax(0,1fr)); gap: var(--space); }
.input-row.record-fields:not(.is-editing) { display: none; }
.input-row > *, .input-row label { min-width: 0; }

select, input[type="text"], .record-fields input,
body.night input, body.night select, body.night .record-fields input {
  width: 100%; max-width: 100%; min-width: 0;
  min-height: var(--control-height);
  height: var(--control-height);
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(0,0,0,.015);
  font-size: 16px;
  font-weight: 500;
  line-height: normal;
  text-align: left;
  -webkit-appearance: none;
  appearance: none;
}
.record-fields input[type="hidden"], body.night .record-fields input[type="hidden"] { display: none; }
select { padding-right: 24px; cursor: pointer; }
input[type="text"]::placeholder, body.night input::placeholder { color: var(--subtle); opacity: 1; }
#callsign, #qthContent, #type, #locator,
#mySignal, #myRadio, #hisSignal, #hisRadio, #frequency, #modulation,
.input-row.note-fields #frequency, .input-row.note-fields #modulation { width: 100%; margin: 0; }
.record-fields label, body.night .record-fields label { color: var(--subtle); font-size: 12px; font-weight: 650; letter-spacing: .01em; }
.record-fields label input { margin-top: 6px; }
.record-fields .date-time-field { text-align: center; font-variant-numeric: tabular-nums; }
select:focus, input[type="text"]:focus, .record-fields input:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--ring);
}

.button-group { display: flex; gap: var(--space); align-items: stretch; }
.button-group button, .modal-content button,
.station-panel #stationContinue, .station-panel .backup-buttons button {
  min-height: 48px;
  border-radius: var(--radius);
  padding: 11px 12px;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.2;
  border: 1px solid transparent;
  cursor: pointer;
}
.button-group .save-button, .button-group .delete-entry-button {
  margin: 3px 0 0;
  width: 100%;
  min-height: 54px;
  font-size: 18px;
}
.save-button, body.night .save-button,
.station-panel #stationContinue, .modal-content #betaWarningOk,
.modal-content #expiredMessageOk {
  background: var(--brand);
  color: var(--on-brand);
}
.save-button:hover, .station-panel #stationContinue:hover { background: var(--brand-hover); }
.delete-entry-button, #deleteButton { background: var(--danger); color: #fff; }
.delete-entry-button:hover, #deleteButton:hover { background: var(--danger-hover); }
#exportButton, #shareButton, #exportC6vButton {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--line);
}
.bottom-buttons { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); margin: 9px 0 14px; gap: 8px; }
.bottom-buttons.is-editing { display: none; }
.bottom-buttons > button, #deleteButton, #exportButton, #shareButton, #exportC6vButton {
  width: 100% !important;
  min-width: 0;
  margin: 0 !important;
  padding: 10px 5px;
  font-size: clamp(11px,3vw,14px);
  white-space: nowrap;
}
.band-delete-row { display: flex; justify-content: center; margin: 18px 0 10px; }
.band-delete-row #deleteButton {
  width: 100% !important;
  min-height: 47px;
  padding: 10px 16px;
  margin: 0 !important;
  font-size: 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
}
.band-delete-row #deleteButton[hidden] { display: none !important; }

#logList, body.night #logList {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 105px;
  padding: 14px;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}
#logList .log-time, body.night #logList .log-time { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
#logList .log-azimuth, body.night #logList .log-azimuth {
  display: inline; min-height: 0; margin: 0; padding: 0 2px;
  color: var(--brand); background: transparent; border: 0;
  border-bottom: 1px dashed currentColor; border-radius: 0;
  font: inherit; font-weight: 750; line-height: inherit; cursor: pointer;
}
#logList.empty { color: var(--subtle); }
#output, body.night #output { color: var(--brand); font-size: 14px; min-height: 14px; }
#output.error { color: var(--danger); }

/* Denní a noční kartografický vzhled zachovává přesnou geometrii podkladu. */
#map {
  height: auto;
  aspect-ratio: 2 / 1;
  margin-top: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #e0ede5;
  box-shadow: 0 2px 9px rgba(10,42,20,.05);
  overflow: hidden;
}
#mapImage { filter: saturate(.65) contrast(1.08) brightness(1.04); transition: filter .2s ease; }
body.night #map { background: #10241d; border-color: #61816d; }
body.night #mapImage { filter: brightness(.43) contrast(1.35) saturate(.6) sepia(.2) hue-rotate(78deg); }
.map-tooltip, body.night .map-tooltip {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
  box-shadow: var(--shadow);
  border-radius: 10px !important;
  max-width: min(280px,85vw);
  font-size: 13px;
}

/* Dialogy a hlavní stránka. Reklamní úvod vždy denní. */
.modal { background: rgba(10,20,15,.65); padding: 18px; }
.modal-content, body.night .modal-content {
  width: min(100%,500px);
  max-width: 100%;
  max-height: min(90dvh,900px);
  overflow-y: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(18px,4vw,27px);
  box-shadow: var(--shadow);
}
.modal-content h2, .voice-panel h2, body.night .voice-panel h2 {
  margin: 2px 0 15px;
  color: var(--text);
  font-size: clamp(21px,5vw,26px);
  line-height: 1.2;
  font-weight: 760;
  letter-spacing: -.025em;
}
#betaWarning .modal-content { background: #fff; color: #15281c; border-color: #d5e3d7; }
#betaWarning h2 { color: #173c29; }
#betaWarning #validityNotice { font-size: 13px; color: #526556; }
#betaWarning a { color: #195b3c !important; }
#betaWarningOk { max-width: 100%; margin: 10px auto 0; }
.station-panel { width: min(100%,520px); text-align: left; }
.station-panel h2 { text-align: left; padding-right: 50px; }
.station-panel label { color: var(--subtle); font-size: 13px; font-weight: 690; margin: 15px 0 6px; }
.station-panel input, body.night .station-panel input { margin: 0; height: var(--control-height); border-radius: var(--radius); padding: 0 14px; }
.station-panel .setup-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 9px; }
.station-panel .setup-extra-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; }
.station-panel .setup-extra-grid label { min-width: 0; }
.station-panel .setup-row #stationGps { height: var(--control-height); margin: 0; padding: 8px 12px; font-size: 13px; }
.station-panel #stationContinue { margin: 13px 0 20px; width: 100%; font-size: 17px; }
.station-panel .dx-calendar-open {
  width: 100%; margin: -9px 0 20px; min-height: 48px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface-alt); color: var(--brand);
  font-size: 16px; font-weight: 750; cursor: pointer;
}
.dx-calendar-panel { width: min(100%, 580px); max-height: 90vh; overflow-y: auto; text-align: left; }
.dx-calendar-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.dx-calendar-head h2 { margin: 0; }
.dx-calendar-head button, .dx-calendar-compass {
  min-height: 40px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-alt); color: var(--brand); padding: 8px 14px; cursor: pointer;
  font-size: 14px; font-weight: 700;
}
.dx-calendar-list { display: grid; gap: 12px; }
.dx-calendar-item { position: relative; border: 1px solid var(--line); border-radius: var(--radius); padding: 13px; padding-right: 65px; background: var(--surface-alt); }
.dx-calendar-item h3 { margin: 4px 0 6px; font-size: 17px; color: var(--text); }
.dx-calendar-item p { margin: 5px 0; font-size: 14px; line-height: 1.45; color: var(--text); }
.dx-calendar-item .dx-calendar-date, .dx-calendar-item .dx-calendar-distance { color: var(--brand); font-weight: 750; }
.dx-calendar-item .dx-calendar-description { color: var(--subtle); }
.dx-calendar-item .dx-calendar-compass {
  position: absolute; top: 10px; right: 10px; width: 43px; height: 43px;
  display: flex; align-items: center; justify-content: center;
  padding: 0; margin: 0; background: var(--surface); color: var(--brand);
}
.dx-calendar-compass svg { display: block; }
.dx-calendar-source { margin: 22px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--subtle); }
.dx-calendar-source a { color: var(--brand); }
.station-panel .backup-buttons button { margin: 0; min-height: 47px; background: var(--surface-alt); color: var(--brand); border: 1px solid var(--line); }
.station-panel .backup-buttons button:hover { background: var(--brand-soft); }
.station-panel .personal-db-section { margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line); }
.station-panel .personal-db-section h3 { margin: 0 0 5px; font-size: 16px; font-weight: 730; }
.station-panel .personal-db-section .setup-help { margin: 0 0 11px; font-size: 12px; }
.station-panel .personal-db-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.station-panel .personal-db-actions button { margin: 0; min-width: 0; padding: 9px 5px; font-size: 14px; min-height: 43px; }
.station-panel #personalDbClear { background: var(--surface-alt); color: var(--danger); border: 1px solid var(--line); }
.station-panel .theme-toggle, body.night .station-panel .theme-toggle {
  position: absolute;
  right: 18px; top: 18px;
  width: 43px; height: 43px;
  margin: 0; padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--brand);
  font-size: 25px;
}
.setup-help, body.night .setup-help { color: var(--subtle); font-size: 12px; line-height: 1.55; }
#stationError { color: var(--danger); font-size: 13px; }
#stationError.success, body.night #stationError.success { color: var(--brand); }

.voice-panel, body.night .voice-panel { width: min(100%,480px); text-align: left; }
.voice-panel h2 { text-align: center; }
.voice-panel .voice-controls { gap: 9px; margin: 13px 0; }
.voice-panel .voice-controls button { margin: 0; font-size: 14px; }
.voice-panel .voice-rec { background: #ad3c4b; color: white; }
.voice-panel .voice-stop-rec { background: #9b4650; color: white; }
.voice-panel .voice-play-controls button { background: var(--brand); color: var(--on-brand); }
.voice-panel .voice-play-controls select { height: 48px; min-height: 48px; margin: 0; }
.voice-panel .record-elapsed { font-size: 24px; color: var(--danger); font-variant-numeric: tabular-nums; }
.voice-panel #voiceStatus { color: var(--subtle); text-align: center; font-size: 13px; }

/* Růžice je vázaná na vypočtený azimut, nikoliv na poslední GPS polohu. */
.compass-panel, body.night .compass-panel { width: min(100%,420px); text-align: center; position: relative; }
.compass-panel h2, body.night .compass-panel h2 { margin: 0 0 17px; color: #24583a; font-size: clamp(25px,6vw,32px); font-weight: 700; font-variant-numeric: tabular-nums; }
body.night .compass-panel h2 { color: #a6dfb6; }
.compass-panel .compass-close {
  position: absolute; right: 13px; top: 11px;
  width: 38px; height: 38px; min-height: 38px;
  padding: 0; margin: 0; border-radius: 50%;
  background: var(--surface-alt); border: 1px solid var(--line);
  color: var(--text); font-size: 27px; line-height: 1;
}
.compass-reading { display: flex; justify-content: center; align-items: baseline; margin: 8px 0 3px; }
.compass-reading strong { font-size: clamp(25px,6vw,32px); font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text); }
.compass-reading strong { white-space: nowrap; }
.compass-face {
  position: relative; margin: 0 auto 15px;
  width: min(72vw,285px); aspect-ratio: 1;
  border-radius: 50%; border: 8px solid var(--line);
  background: repeating-conic-gradient(from 0deg, transparent 0deg 29deg, var(--line) 29deg 30deg),
    radial-gradient(circle at center, var(--surface) 0 49%, var(--surface-alt) 50% 100%);
  box-shadow: inset 0 0 0 2px var(--surface), 0 5px 18px rgba(0,0,0,.1);
}
.compass-cardinal { position: absolute; color: var(--subtle); font-size: 14px; font-weight: 800; z-index: 2; }
.compass-cardinal.north { top: 8px; left: 50%; transform: translateX(-50%); }
.compass-cardinal.south { bottom: 8px; left: 50%; transform: translateX(-50%); }
.compass-cardinal.east { right: 12px; top: 50%; transform: translateY(-50%); }
.compass-cardinal.west { left: 12px; top: 50%; transform: translateY(-50%); }
.compass-arrow {
  position: absolute; left: calc(50% - 3px); top: 15%;
  height: 35%; width: 6px; border-radius: 4px;
  transform-origin: 50% 100%; z-index: 3;
  transition: transform .18s linear;
}
.compass-arrow::before {
  content: ''; position: absolute; left: -8px; top: -8px;
  width: 0; height: 0; border-left: 11px solid transparent;
  border-right: 11px solid transparent; border-bottom: 18px solid currentColor;
}
.north-arrow { background: #111; color: #111; width: 4px; left: calc(50% - 2px); }
.target-arrow { background: #24583a; color: #24583a; width: 6px; }
body.night .north-arrow, body.night .target-arrow { filter: drop-shadow(0 0 2px rgba(255,255,255,.9)); }
.compass-hub { position: absolute; width: 17px; height: 17px; border-radius: 50%; background: var(--text); border: 4px solid var(--surface); left: 50%; top: 50%; transform: translate(-50%,-50%); z-index: 5; }
.compass-status { color: var(--brand); font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.compass-panel .setup-help { margin: 0; }

#suggestionBox, #callsignSuggestionBox,
body.night #suggestionBox, body.night #callsignSuggestionBox {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: var(--shadow);
  overflow-y: auto;
}
.suggestion-item, body.night .suggestion-item { border-color: var(--line); font-size: 14px; }
.suggestion-item.personal-suggestion { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.personal-call-remove, body.night .personal-call-remove {
  flex: 0 0 30px; width: 30px; height: 30px; min-height: 30px;
  padding: 0; margin: 0; border: 1px solid #b64c4c; border-radius: 8px;
  color: #bd3030; background: transparent; font-size: 22px; line-height: 1;
}
.suggestion-item:hover, .suggestion-item.selected,
body.night .suggestion-item:hover, body.night .suggestion-item.selected { background: var(--brand-soft); color: var(--text); }

@media (max-width: 440px) {
  :root { --control-height: 46px; --space: 9px; }
  header { padding-left: 10px; padding-right: 10px; }
  .header-content { grid-template-columns: 52px minmax(0,1fr) auto 44px; gap: 6px; }
  header #connectionType, header #openVoice { height: 43px; }
  header #stats { padding: 9px 2px; }
  main { margin-top: calc(126px + env(safe-area-inset-top,0px)); }
  .input-row:not(.record-fields):not(.note-fields) { gap: 9px; }
  .input-row:has(> #mySignal) { gap: 6px; }
  .input-row:has(> #mySignal) select { padding: 0 4px; text-align: center; font-size: 13px; }
  select, input[type="text"], .record-fields input, body.night select, body.night input { font-size: 16px; }
  .bottom-buttons > button { min-height: 44px; }
  #logList { font-size: 12px; }
  .station-panel .setup-row #stationGps { padding: 5px 9px; font-size: 12px; }
  .voice-play-controls { grid-template-columns: 66px minmax(0,1fr) minmax(0,1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
