/* LocurAI színek, sötét téma */
:root {
  --bg: #2A3540;
  --surface: #3A4752;
  --surface-active: #4A5866;
  --text: #FFFFFF;
  --text-dim: rgba(255, 255, 255, 0.65);
  --text-muted: rgba(255, 255, 255, 0.8);
  --copper: #B08C5A;
  --copper-active: #9A7848;
  --warning: #E3CFAE;
  --radius: 18px;
  --gap: 12px;
  --font: -apple-system, system-ui, sans-serif;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

body {
  min-height: 100dvh;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body.running {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

button:active:not(:disabled) {
  background: var(--surface-active);
}

button:disabled {
  opacity: 0.3;
  cursor: default;
}

button:focus-visible {
  outline: 3px solid var(--copper);
  outline-offset: 2px;
}

.view {
  min-height: 100dvh;
  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}

/* ---------- Beállító képernyő ---------- */

.setup {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 560px;
  margin: 0 auto;
}

.brand {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-align: center;
  color: var(--copper);
}

.fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 76px;
  grid-template-areas:
    "label label label"
    "minus value plus";
  align-items: center;
  gap: 6px 12px;
}

.field-label {
  grid-area: label;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.field-value {
  grid-area: value;
  text-align: center;
  font-size: clamp(2.4rem, 12vw, 3.5rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}

.step {
  width: 76px;
  height: 76px;
  font-size: 2.6rem;
  line-height: 1;
  padding: 0;
  /* nyomva tartás közben egy kis csúszás se szakítsa meg az ismétlést */
  touch-action: none;
}

.minus {
  grid-area: minus;
}

.plus {
  grid-area: plus;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  margin-top: auto;
}

.warning {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.35;
  text-align: center;
  color: var(--warning);
}

.secondary {
  min-height: 56px;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-muted);
}

.start {
  min-height: 104px;
  background: var(--copper);
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.start:active:not(:disabled) {
  background: var(--copper-active);
}

/* ---------- Futás képernyő ---------- */

.run {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 16px;
  transition: background-color 150ms ease-out;
}

.run.flash {
  background: var(--copper);
  transition: none;
}

.display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.status {
  min-height: 1.2em;
  font-size: clamp(1.25rem, 6vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.3em;
  color: var(--copper);
}

.run.flash .status {
  color: var(--text);
}

.time {
  font-size: min(38vw, 30vh);
  line-height: 1;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}

/* 10:00 felett öt karakter: kisebb, hogy kiférjen */
.time.long {
  font-size: min(29vw, 30vh);
}

/* „KÉSZ” */
.time.word {
  font-size: min(24vw, 24vh);
}

.run.paused .time {
  opacity: 0.4;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}

.controls button {
  min-height: 88px;
  font-size: 1.6rem;
  font-weight: 700;
}

.stop {
  color: var(--text-muted);
}

/* ---------- Fekvő mód (telefon) ---------- */

@media (orientation: landscape) and (max-height: 560px) {
  .setup {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    align-items: center;
    gap: 24px;
    max-width: 960px;
  }

  .brand {
    display: none;
  }

  .fields {
    gap: 10px;
  }

  .field {
    grid-template-columns: minmax(0, 0.9fr) 64px minmax(0, 1.2fr) 64px;
    grid-template-areas: "label minus value plus";
    gap: 10px;
  }

  .field-label {
    text-align: left;
  }

  .field-value {
    font-size: 2.2rem;
  }

  .step {
    width: 64px;
    height: 64px;
    font-size: 2.2rem;
  }

  .actions {
    margin-top: 0;
  }

  .start {
    min-height: 88px;
  }

  .run {
    gap: 8px;
  }

  .time {
    font-size: min(30vw, 52vh);
  }

  .time.long {
    font-size: min(23vw, 52vh);
  }

  .time.word {
    font-size: min(20vw, 44vh);
  }

  .status {
    font-size: 1.1rem;
  }

  .controls button {
    min-height: 64px;
  }
}
