﻿:root {
  color-scheme: light dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --background: #f2f2f7;
  --surface: #ffffff;
  --text: #1c1c1e;
  --muted: #56565e;
  --accent: #005ac1;
  --on-accent: #ffffff;
  --pressed: #00499c;
  --error: #b42318;
  --success: #216b38;
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --radius-control: .875rem;
  --radius-field: 1rem;
  --radius-pill: 999px;
  --font-body: 1.0625rem;
  --font-note: .9375rem;
  --font-title: 2.125rem;
  --touch-target: 44px;
  --button-height: 56px;
  --content-width: 40rem;
  color: var(--text);
  background: var(--background);
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #000000;
    --surface: #1c1c1e;
    --text: #f5f5f7;
    --muted: #b5b5bd;
    --accent: #91c5ff;
    --on-accent: #001d3d;
    --pressed: #b8daff;
    --error: #ffb4a9;
    --success: #8cdda0;
  }
}

* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; font-size: var(--font-body); }
[hidden] { display: none !important; }
.app {
  position: absolute;
  top: var(--viewport-top, 0px);
  left: 0;
  right: 0;
  height: 100vh;
  height: var(--viewport-height, 100dvh);
  max-width: var(--content-width);
  margin-inline: auto;
  padding: max(var(--space-2), env(safe-area-inset-top)) max(var(--space-4), env(safe-area-inset-right)) max(var(--space-3), env(safe-area-inset-bottom)) max(var(--space-4), env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
}
section { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); padding-block: var(--space-2) var(--space-4); flex-shrink: 0; }
h1 { margin: 0; font-size: var(--font-title); line-height: 1.18; letter-spacing: -.025em; font-weight: 700; overflow-wrap: anywhere; }
#main-title { flex-shrink: 0; max-width: 100%; }
#main-screen .navigation { margin-left: auto; }
#settings-screen .topbar { flex-direction: column; align-items: flex-start; }
.navigation { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1); min-width: var(--touch-target); min-height: var(--touch-target); padding: var(--space-2); border-radius: var(--radius-control); color: var(--accent); font-weight: 600; text-decoration: none; flex-shrink: 0; touch-action: manipulation; }
.navigation svg { flex-shrink: 0; }
.screen-body { display: flex; flex: 1; min-height: 0; flex-direction: column; }
.editor, .settings-fields { flex: 1; min-height: 0; overflow-y: auto; overflow-wrap: anywhere; padding: var(--space-1); margin: calc(-1 * var(--space-1)); scroll-padding: var(--space-3); }
.editor { display: flex; flex-direction: column; gap: var(--space-3); }
.field-title { display: block; font-size: var(--font-body); font-weight: 600; }
p { margin: 0; line-height: 1.4; }
.muted { color: var(--muted); }
.small { font-size: var(--font-note); }
textarea, input, button { font: inherit; }
textarea, input {
  width: 100%;
  padding: var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-field);
  color: var(--text);
  background: var(--surface);
  font-size: max(16px, var(--font-body));
  line-height: 1.5;
}
textarea { display: block; flex: 1; min-height: 8rem; resize: none; }
textarea::placeholder, input::placeholder { color: var(--muted); opacity: 1; }
input { min-height: var(--button-height); margin-top: var(--space-4); }
.actions { flex-shrink: 0; display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-3); background: var(--background); max-height: 65%; }
.action-details { min-height: 0; overflow-y: auto; padding: var(--space-1); margin: calc(-1 * var(--space-1)); }
.status { font-size: var(--font-note); overflow-wrap: anywhere; }
.status:empty { display: none; }
.status[data-state="error"] { color: var(--error); }
.status[data-state="success"] { color: var(--success); }
.status[data-state="sending"] { color: var(--muted); }
.primary { flex-shrink: 0; width: 100%; min-width: var(--touch-target); min-height: var(--button-height); padding: var(--space-3) var(--space-4); border: 0; border-radius: var(--radius-pill); background: var(--accent); color: var(--on-accent); font-size: var(--font-body); line-height: 1.4; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.primary:active { background: var(--pressed); }
.navigation:active { background: var(--surface); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1:focus-visible { outline-offset: 0; }
#offline-status:not(:empty), noscript { flex-shrink: 0; max-height: 20%; overflow-y: auto; margin-top: var(--space-2); }
@media (max-height: 500px) {
  .topbar { padding-block: 0 var(--space-2); }
  h1 { font-size: 1.5rem; }
  .editor { gap: var(--space-2); }
  .actions { margin-top: var(--space-2); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
