* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  background: #0f1a14;
  font-family: 'Lora', serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  --app-header-h: clamp(48px, 12vw, 56px);
  --app-footer-h: clamp(52px, 14vw, 60px);
  padding: calc(var(--app-header-h) + env(safe-area-inset-top, 0px) + 12px) 16px
    calc(var(--app-footer-h) + env(safe-area-inset-bottom, 0px) + 16px) 16px;
}

/* ── App chrome (pod / nad obsahom, mimo landing) ── */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: var(--app-header-h);
  padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px 16px;
  background: linear-gradient(180deg, rgba(15, 26, 20, 0.97) 0%, rgba(15, 26, 20, 0.88) 70%, transparent 100%);
  border-bottom: 1px solid rgba(45, 92, 62, 0.45);
  box-shadow:
    0 1px 0 rgba(127, 255, 196, 0.06),
    0 8px 20px -6px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.app-header-brand {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2vw, 14px);
  margin: 0;
  padding: 0;
  font: inherit;
  font-weight: inherit;
}

.app-header-title {
  font-family: 'DM Mono', monospace;
  font-size: clamp(15px, 4.2vw, 22px);
  font-weight: 600;
  letter-spacing: 0.18em;
  color: #7fffc4;
  text-transform: uppercase;
  line-height: 1;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.app-header-logo {
  flex-shrink: 0;
  pointer-events: auto;
  height: calc(var(--app-header-h) - 8px);
  width: calc(var(--app-header-h) - 8px);
  object-fit: contain;
  border-radius: 22%;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.app-main {
  width: 100%;
  max-width: 760px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--app-footer-h);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)) 16px;
  background: linear-gradient(0deg, rgba(15, 26, 20, 0.97) 0%, rgba(15, 26, 20, 0.88) 65%, transparent 100%);
  border-top: 1px solid rgba(45, 92, 62, 0.45);
  box-shadow:
    0 -1px 0 rgba(127, 255, 196, 0.06),
    0 -8px 20px -6px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.btn-footer-continue,
.btn-footer-next {
  pointer-events: auto;
  min-width: min(280px, 92vw);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn-footer-continue {
  font-family: 'DM Mono', monospace;
  font-size: clamp(10px, 2.6vmin, 13px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7fffc4;
  background: rgba(26, 107, 58, 0.35);
  border: 1px solid rgba(127, 255, 196, 0.35);
  border-radius: clamp(6px, 1.5vmin, 10px);
  padding: clamp(10px, 2.5vmin, 14px) clamp(14px, 4vmin, 24px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.btn-footer-continue:hover {
  background: rgba(26, 107, 58, 0.55);
  border-color: rgba(127, 255, 196, 0.55);
}

.btn-footer-continue:active {
  transform: scale(0.98);
}

.btn-footer-next {
  font-family: 'DM Mono', monospace;
  font-size: clamp(12px, 3.2vw, 15px);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: #0f1a14;
  background: linear-gradient(135deg, #7fffc4, #4ade8a);
  border: 1px solid rgba(212, 252, 232, 0.5);
  border-radius: 8px;
  padding: 12px 28px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

.btn-footer-next:hover {
  filter: brightness(1.06);
}

.btn-footer-next:active {
  transform: scale(0.98);
}

/* Landing: v pätičke „Pokračovať“; v editore len „Ďalší“ */
#landingScreen:not(.landing-screen--hidden) ~ .app-footer .btn-footer-next {
  display: none;
}

#landingScreen.landing-screen--hidden ~ .app-footer .btn-footer-continue {
  display: none;
}

/* ── Header ── */
.badge {
  display: inline-block;
  background: linear-gradient(135deg, #1a3a2a, #0f2018);
  border: 1px solid #2d5c3e;
  border-radius: 6px;
  padding: 5px 16px;
  color: #7fffc4;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 14px;
}

h1 {
  color: #f0ede6;
  font-size: clamp(26px, 5vw, 44px);
  font-weight: 400;
  font-style: italic;
  margin-bottom: 8px;
  text-align: center;
}

.subtitle {
  color: #6b9e82;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  margin-bottom: 36px;
  text-align: center;
}

/* ── Card ── */
.card {
  width: 100%;
  max-width: 760px;
  min-width: 0;
  margin-bottom: 20px;
}

.input-card {
  background: #fffef8;
  border-radius: 6px;
  border: 1px solid #d4c9a0;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  overflow-x: hidden;
  min-width: 0;
}

.card-header {
  background: #1a6b3a;
  padding: 9px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-header span {
  color: #d4fce8;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.btn-example {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #d4fce8;
  border-radius: 4px;
  padding: 3px 12px;
  font-size: 11px;
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  transition: background 0.2s;
}

.btn-example:hover {
  background: rgba(255, 255, 255, 0.25);
}

.header-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.btn-login {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #d4fce8;
  border-radius: 4px;
  padding: 3px 12px;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  text-decoration: none;
  transition: background 0.2s;
}

.btn-login:hover {
  background: rgba(255, 255, 255, 0.25);
}

.btn-logout {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #d4fce8;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  cursor: pointer;
  margin-left: 4px;
}

.user-info {
  display: flex;
  align-items: center;
}

.provider-row {
  padding: 10px 18px;
  border-bottom: 1px solid #e8e0c8;
  background: #f7faf7;
}

.provider-label {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 1px;
  color: #1a6b3a;
  text-transform: uppercase;
  margin-bottom: 7px;
}

.provider-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.provider-btn {
  background: #fff;
  border: 1px solid #d4c9a0;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  cursor: pointer;
  color: #2a1f0a;
  transition: all 0.15s;
}

.provider-btn:hover {
  border-color: #1a6b3a;
  color: #1a6b3a;
}

.provider-btn.active {
  background: #1a6b3a;
  border-color: #1a6b3a;
  color: #fff;
}

.model-apikey-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

/* <form> namiesto div — žiadny extra okraj */
.provider-apikey-form {
  margin: 0;
  padding: 0;
  border: none;
  width: 100%;
}

.model-select {
  flex: 1 1 160px;
  min-width: min(140px, 100%);
  padding: 6px 10px;
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  border: 1px solid #d4c9a0;
  border-radius: 6px;
  background: #fff;
  color: #2a1f0a;
}

.provider-apikey {
  flex: 2 1 200px;
  min-width: min(160px, 100%);
  padding: 6px 10px;
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  border: 1px solid #d4c9a0;
  border-radius: 6px;
  background: #fff;
  color: #2a1f0a;
}

.btn-provider-key {
  border: 1px solid #1a6b3a;
  background: #fff;
  color: #1a6b3a;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  cursor: pointer;
}

.btn-provider-key:hover {
  background: #e9f5ee;
}

.btn-provider-key-danger {
  border-color: #8b2f2f;
  color: #8b2f2f;
}

.btn-provider-key-danger:hover {
  background: #fdecec;
}

.provider-key-status {
  margin-top: 8px;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  color: #4a7359;
}

.lang-row {
  padding: 10px 18px;
  border-bottom: 1px solid #e8e0c8;
  background: #fafaf4;
}

.lang-label {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 1px;
  color: #1a6b3a;
  text-transform: uppercase;
  margin-bottom: 7px;
}

.lang-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lang-btn {
  background: #fff;
  border: 1px solid #d4c9a0;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  cursor: pointer;
  color: #2a1f0a;
  transition: all 0.15s;
}

.lang-btn:hover {
  border-color: #1a6b3a;
  color: #1a6b3a;
}

.lang-btn.active {
  background: #1a6b3a;
  border-color: #1a6b3a;
  color: #fff;
}

/* ── Textarea ── */
textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 16px 18px;
  font-family: 'Lora', serif;
  font-size: 14px;
  line-height: 1.75;
  color: #2a1f0a;
  background: transparent;
  border: none;
  outline: none;
  resize: vertical;
  min-height: 120px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

textarea::placeholder {
  color: #a09070;
}

.upload-row {
  padding: 12px 18px;
  border-top: 1px dashed #d4c9a0;
  background: #fafaf2;
}

/*
 * Android Chrome / WebView: skrytý file input s display:none často otvorí len „vybrať súbor“
 * a ignoruje capture=. Tento vzor ponechá prvok v layoute (1px), nie display:none.
 */
.camera-input-ux-hidden {
  position: fixed;
  left: 0;
  top: -2000px;
  width: 4px;
  height: 4px;
  margin: 0;
  padding: 0;
  opacity: 0.02;
  overflow: hidden;
  border: 0;
}

/* getUserMedia náhľad — Snímka, keď <input capture> otvára len výber súborov */
.landing-camera-overlay {
  position: fixed;
  inset: 0;
  z-index: 2600;
  background: rgba(8, 14, 11, 0.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}

.landing-camera-overlay video {
  width: 100%;
  max-width: min(100%, 720px);
  max-height: min(62vh, 70vw);
  max-height: min(62dvh, 70vw);
  border-radius: 8px;
  background: #000;
  object-fit: contain;
}

.landing-camera-overlay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.landing-camera-btn {
  font-family: 'DM Mono', monospace;
  font-size: clamp(11px, 2.8vw, 13px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 8px;
  padding: 12px 18px;
  cursor: pointer;
  border: 1px solid;
  transition: filter 0.15s ease, transform 0.12s ease;
}

.landing-camera-btn:active {
  transform: scale(0.98);
}

.landing-camera-btn-primary {
  background: linear-gradient(135deg, #7fffc4, #4ade8a);
  color: #0f1a14;
  border-color: rgba(212, 252, 232, 0.5);
}

.landing-camera-btn-ghost {
  background: rgba(26, 107, 58, 0.25);
  color: #7fffc4;
  border-color: rgba(127, 255, 196, 0.45);
}

.upload-label {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: #1a6b3a;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  cursor: pointer;
}

#fileInput {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: #2a1f0a;
  width: 100%;
}

.file-preview {
  margin-top: 6px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: #1a6b3a;
  min-height: 16px;
}

/* ── Footer / button ── */
.card-footer {
  padding: 12px 18px;
  border-top: 1px solid #e8e0c8;
  display: flex;
  justify-content: flex-end;
}

.btn-translate {
  background: #1a6b3a;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 10px 28px;
  font-size: 13px;
  font-family: 'DM Mono', monospace;
  cursor: pointer;
  letter-spacing: 1px;
  transition: background 0.2s;
}

.btn-translate:hover:not(:disabled) {
  background: #228b4a;
}

.btn-translate:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Output ── */
.output-card {
  background: #122118;
  border-radius: 6px;
  border: 1px solid #2d5c3e;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  min-width: 0;
  width: 100%;
  display: none;
  animation: fadeIn 0.4s ease;
}

.output-header {
  background: #1a3a2a;
  padding: 9px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.check {
  color: #7fffc4;
  font-size: 15px;
  flex-shrink: 0;
}

.output-header-label {
  color: #7fffc4;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* Semafor dot v headeri */
.semafor-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.semafor-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  background: #7fffc4;
  transition: background 0.3s;
}

.semafor-badge-text {
  color: #7fffc4;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: color 0.3s;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.output-body {
  padding: 22px 26px;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.usage-info {
  width: 100%;
  max-width: 760px;
  min-width: 0;
  text-align: center;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: #6b9e82;
  margin-bottom: 10px;
  overflow-wrap: anywhere;
  word-break: break-word;
  padding: 0 4px;
}

.usage-info a {
  color: #7fffc4;
  text-decoration: underline;
}

.section-label {
  display: inline-block;
  background: #1a3a2a;
  color: #7fffc4;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 3px;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.section-text {
  margin: 0 0 18px 0;
  color: #d4efe3;
  font-size: 15px;
  line-height: 1.7;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ZELENA */
.semafor-green {
  background: #0f2a1a !important;
  border-color: #2d8a4e !important;
}
.semafor-green .output-header {
  background: #1a4a2a !important;
}
.semafor-green .semafor-badge-text { color: #7fffc4; }
.semafor-green .semafor-dot { background: #7fffc4; }
.semafor-green .section-label {
  background: #1a4a2a !important;
  color: #7fffc4 !important;
}
.semafor-green .section-text { color: #c8eed8 !important; }

/* ZLTA */
.semafor-yellow {
  background: #2a2500 !important;
  border-color: #c8a800 !important;
}
.semafor-yellow .output-header {
  background: #3a3400 !important;
}
.semafor-yellow .semafor-badge-text { color: #ffd700; }
.semafor-yellow .semafor-dot { background: #ffd700; }
.semafor-yellow .section-label {
  background: #3a3400 !important;
  color: #ffd700 !important;
}
.semafor-yellow .section-text { color: #ede8c0 !important; }

/* CERVENA */
.semafor-red {
  background: #2a0a0a !important;
  border-color: #8B0000 !important;
}
.semafor-red .output-header {
  background: #3a1010 !important;
}
.semafor-red .semafor-badge-text { color: #ff8080; }
.semafor-red .semafor-dot { background: #ff6060; }
.semafor-red .section-label {
  background: #3a1010 !important;
  color: #ff8080 !important;
}
.semafor-red .section-text { color: #f0d0d0 !important; }

/* Animacia pri zmene */
.output-card {
  transition: background 0.4s ease, border-color 0.4s ease;
}

/* Pulzovanie pre cervenu */
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139,0,0,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(139,0,0,0); }
}
.semafor-red {
  animation: pulse-red 2s ease-in-out 3;
}

.pdf-row {
  width: 100%;
  max-width: 760px;
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}

.btn-pdf {
  background: transparent;
  border: 1px solid #2d5c3e;
  border-radius: 5px;
  color: #7fffc4;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  padding: 8px 18px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.2s;
}

.btn-pdf:hover {
  background: #1a3a2a;
  border-color: #7fffc4;
}

.action-row {
  width: 100%;
  max-width: 760px;
  min-width: 0;
  margin-bottom: 16px;
  padding: 0 4px;
}

.deadline-info {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: #ffd700;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: #2a2500;
  border: 1px solid #c8a800;
  border-radius: 6px;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-action {
  background: transparent;
  border: 1px solid #2d5c3e;
  border-radius: 5px;
  color: #7fffc4;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  padding: 8px 16px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-action:hover {
  background: #1a3a2a;
  border-color: #7fffc4;
}

.btn-calendar {
  border-color: #c8a800;
  color: #ffd700;
}

.btn-calendar:hover {
  background: #2a2500;
  border-color: #ffd700;
}

.btn-notify {
  border-color: #2d5c3e;
  color: #6b9e82;
}

.btn-notify:hover {
  background: #1a3a2a;
  border-color: #7fffc4;
  color: #7fffc4;
}

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a3a2a;
  border: 1px solid #2d5c3e;
  color: #7fffc4;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  padding: 10px 20px;
  border-radius: 20px;
  z-index: 999;
  white-space: nowrap;
  animation: fadeIn 0.3s ease;
}

/* ── States ── */
.loading {
  text-align: center;
  padding: 20px;
  color: #6b9e82;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  display: none;
}

.spinner {
  display: inline-block;
  animation: spin 1s linear infinite;
  margin-right: 6px;
}

.error-box {
  background: #2a0a0a;
  border: 1px solid #8b0000;
  border-radius: 6px;
  padding: 14px 18px;
  color: #ff8080;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  display: none;
  word-break: break-word;
}

.disclaimer {
  color: #3d5c48;
  font-size: 11px;
  text-align: center;
  font-family: 'DM Mono', monospace;
  margin-top: 8px;
}

.admin-link-wrap {
  margin-top: 6px;
}

.admin-link {
  color: #3d5c48;
  text-decoration: none;
}

/* ── History ── */
.history-section {
  display: none;
  width: 100%;
  max-width: 760px;
  min-width: 0;
  margin-bottom: 20px;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.history-title {
  color: #6b9e82;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.btn-clear-history {
  background: transparent;
  border: 1px solid #2d5c3e;
  border-radius: 4px;
  color: #6b9e82;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  padding: 3px 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-clear-history:hover {
  border-color: #8B0000;
  color: #ff8080;
}

.history-item {
  background: #122118;
  border: 1px solid #1e3d2a;
  border-radius: 6px;
  padding: 14px 18px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.2s;
  min-width: 0;
  overflow-x: hidden;
}

.history-item:hover {
  border-color: #2d5c3e;
}

.history-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  min-width: 0;
}

.history-badge {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
}

.history-badge.text {
  background: #1a3a2a;
  color: #7fffc4;
}

.history-badge.ocr {
  background: #2a2a1a;
  color: #ffc47f;
}

.history-date {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: #3d5c48;
}

.history-lang {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: #3d5c48;
  margin-left: auto;
}

.history-delete-btn {
  margin-left: 8px;
  border-color: #5c2d2d;
  color: #c98d8d;
  padding: 2px 8px;
}

.history-delete-btn:hover {
  border-color: #8b0000;
  color: #ff8080;
  background: rgba(139, 0, 0, 0.12);
}

.history-delete-btn:focus-visible {
  outline: 2px solid #8b0000;
  outline-offset: 2px;
}

.history-input-preview {
  font-size: 12px;
  color: #6b9e82;
  font-family: 'DM Mono', monospace;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-input-full {
  font-size: 12px;
  color: #6b9e82;
  font-family: 'DM Mono', monospace;
  margin-bottom: 6px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.history-result-preview {
  font-size: 13px;
  color: #d4efe3;
  line-height: 1.5;
  display: none;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #1e3d2a;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}

.history-item.expanded .history-result-preview {
  display: block;
}

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

:root {
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

.btn-upload {
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1px dashed #d4c9a0;
  border-radius: 6px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: #1a6b3a;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.btn-upload:hover,
.btn-upload:focus {
  border-color: #1a6b3a;
  background: #f0fff4;
}

/* ── Mobile optimalizácia ───────────────── */
@media (max-width: 600px) {

  body {
    padding: calc(var(--app-header-h) + env(safe-area-inset-top, 0px) + 8px) 12px
      calc(var(--app-footer-h) + env(safe-area-inset-bottom, 0px) + 12px) 12px;
  }

  h1 {
    font-size: 32px;
    margin-bottom: 6px;
  }

  .subtitle {
    font-size: 11px;
    margin-bottom: 24px;
  }

  /* Jazykové tlačidlá — scrollovateľný riadok */
  .lang-options {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    gap: 8px;
  }

  .lang-options::-webkit-scrollbar {
    display: none;
  }

  .lang-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    font-size: 13px;
  }

  /* Textarea — väčšia na mobile */
  textarea {
    min-height: 140px;
    font-size: 16px; /* zabraňuje zoom na iOS pri focuse */
  }

  /* Upload row */
  .upload-row {
    padding: 10px 14px;
  }

  .btn-upload {
    padding: 14px;
    font-size: 14px;
  }

  .action-buttons {
    flex-direction: column;
  }

  .btn-action {
    width: 100%;
    justify-content: center;
  }

  /* Akčné tlačidlo v rámci karty */
  .card-footer {
    display: flex;
    padding: 16px;
  }

  .btn-translate {
    position: static;
    width: 100%;
    padding: 16px;
    font-size: 15px;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(26, 107, 58, 0.5);
    letter-spacing: 2px;
    text-align: center;
  }

  /* Output sekcia */
  .output-body {
    padding: 16px 16px;
  }

  .section-label {
    font-size: 9px;
  }

  .section-text {
    font-size: 14px;
  }

  /* História */
  .history-item {
    padding: 12px 14px;
  }

  .history-input-preview {
    font-size: 11px;
  }

  /* Offline banner */
  #offlineBanner {
    font-size: 11px;
    padding: 8px;
    bottom: calc(72px + var(--safe-bottom));
  }

  /* Badge + nadpis horizontálne centrovanie */
  .badge {
    font-size: 9px;
    letter-spacing: 2px;
  }
}

/* ── Malé telefóny (iPhone SE a pod.) ───── */
@media (max-width: 380px) {
  h1 {
    font-size: 26px;
  }

  .lang-btn {
    padding: 5px 10px;
    font-size: 12px;
  }
}

/* ── Touch optimalizácia (všetky mobily) ── */
@media (hover: none) and (pointer: coarse) {
  .btn-example,
  .lang-btn,
  .history-item,
  .btn-clear-history {
    min-height: 40px;      /* minimálna dotyková plocha */
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .history-item {
    display: block;        /* override flex len pre tlačidlá */
  }
}

/* Počas úvodu: zabrániť gumovému overscrollu / „ťahaniu“ celej stránky na Androide */
html.landing-scroll-lock {
  overflow: hidden;
  height: 100%;
  overscroll-behavior: none;
}

html.landing-scroll-lock body {
  overflow: hidden;
  overscroll-behavior: none;
}

/* ── Úvodná obrazovka (K1 / K2) ── */
.landing-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  padding: calc(var(--app-header-h) + env(safe-area-inset-top, 0px) + 8px)
    max(16px, env(safe-area-inset-right, 0px))
    calc(var(--app-footer-h) + env(safe-area-inset-bottom, 0px) + 8px)
    max(16px, env(safe-area-inset-left, 0px));
  /* Zhodné s paddingom: max. šírka/výška pre K1, aby nepresahoval header/footer */
  --landing-vh: 100vh;
  --landing-vh: 100svh;
  --landing-inner-h: max(
    0px,
    calc(
      var(--landing-vh) - var(--app-header-h) - var(--app-footer-h) -
        env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 16px
    )
  );
  --landing-inner-w: max(
    0px,
    calc(
      100vw - max(16px, env(safe-area-inset-left, 0px)) -
        max(16px, env(safe-area-inset-right, 0px))
    )
  );
  --landing-k1-cap: min(var(--landing-inner-w), var(--landing-inner-h));
  background: radial-gradient(ellipse at 50% 40%, #1a3a2a 0%, #0f1a14 55%);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.landing-screen.landing-screen--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.landing-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(12px, 3.5vmin, 24px);
  width: 100%;
  max-width: 100%;
}

/* K1: portrét 80 % šírky, landscape 80 % výšky; vždy zmestený do --landing-k1-cap */
.landing-k1 {
  --k1: min(var(--landing-k1-cap), max(200px, 80vw), 720px);
  /* Pri zmene uprav aj LANDING_K2_RATIO v main.js (uhlový hit-test prstenca). */
  --k2-ratio: 0.42;
  --r-outer: calc(var(--k1) / 2);
  --r-inner: calc(var(--k1) * var(--k2-ratio) / 2);
  --ring-mid: calc((var(--r-outer) + var(--r-inner)) / 2);

  position: relative;
  width: var(--k1);
  height: var(--k1);
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow:
    0 0 0 clamp(2px, 0.5vmin, 4px) rgba(45, 92, 62, 0.85),
    0 clamp(8px, 2vmin, 20px) clamp(24px, 6vmin, 48px) rgba(0, 0, 0, 0.45);
}

@media (orientation: landscape) {
  .landing-k1 {
    --k1: min(var(--landing-k1-cap), max(200px, 80vh), 720px);
  }
}

.landing-k1-sectors {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
  background: conic-gradient(
    from -90deg,
    rgba(26, 107, 58, 0.35) 0deg 120deg,
    rgba(20, 45, 32, 0.55) 120deg 240deg,
    rgba(26, 107, 58, 0.3) 240deg 360deg
  );
}

/* K2: vnútorný kruh; logo vyplní celú plochu kruhu */
.landing-k2 {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  z-index: 2;
  width: calc(var(--k1) * var(--k2-ratio));
  height: calc(var(--k1) * var(--k2-ratio));
  border-radius: 50%;
  overflow: hidden;
  background: #0f1a14;
  border: clamp(1px, 0.35vmin, 2px) solid rgba(127, 255, 196, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 clamp(12px, 3vmin, 28px) rgba(0, 0, 0, 0.35);
}

.landing-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  filter: drop-shadow(0 clamp(2px, 0.5vmin, 6px) clamp(4px, 1vmin, 12px) rgba(0, 0, 0, 0.4));
}

.landing-ring-actions {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  cursor: default;
}

/* Tri výseky ako SVG path — hover/active/focus len na danom oblúku */
.landing-ring-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  overflow: visible;
}

.landing-svg-sector {
  cursor: pointer;
  transform-origin: 50px 50px;
  transition: transform 0.15s ease;
}

.landing-svg-sector:focus {
  outline: none;
}

.landing-svg-sector-fill {
  fill: rgba(127, 255, 196, 0.07);
  stroke: none;
  transition: fill 0.18s ease, stroke 0.15s ease, stroke-width 0.15s ease;
}

.landing-svg-sector:hover .landing-svg-sector-fill {
  fill: rgba(127, 255, 196, 0.16);
}

.landing-svg-sector:active .landing-svg-sector-fill {
  fill: rgba(127, 255, 196, 0.26);
}

.landing-svg-sector:active {
  transform: scale(0.97);
}

.landing-svg-sector:focus-visible .landing-svg-sector-fill {
  stroke: rgba(127, 255, 196, 0.95);
  stroke-width: 1.75;
}

.landing-ring-icons {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.landing-arc-text {
  fill: #e8fff0;
  font-family: 'DM Mono', monospace;
  font-size: clamp(5px, 1.5vmin, 8px);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8));
}

.landing-sector-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(26px, 6.5vmin, 40px);
  height: clamp(26px, 6.5vmin, 40px);
  color: #d4fce8;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 1;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.55));
}

.landing-sector-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.landing-sector-icon--0 {
  transform: translate(-50%, -50%) rotate(-30deg) translateY(calc(-1 * var(--ring-mid))) rotate(30deg);
}

.landing-sector-icon--1 {
  transform: translate(-50%, -50%) rotate(90deg) translateY(calc(-1 * var(--ring-mid))) rotate(-90deg);
}

.landing-sector-icon--2 {
  transform: translate(-50%, -50%) rotate(210deg) translateY(calc(-1 * var(--ring-mid))) rotate(-210deg);
}

@media (prefers-reduced-motion: reduce) {
  .landing-screen {
    transition: none;
  }

  .landing-svg-sector {
    transition: none;
  }

  .landing-svg-sector:active {
    transform: none;
  }

  .landing-svg-sector-fill {
    transition: none;
  }
}
