:root {
  --cream: #f4f4f1;
  --cream-2: #e9e9e4;
  --surface: #fbfbf9;
  --ink: #25272c;
  --ink-2: #3d4047;
  --muted: #6b6e76;
  --red: #d6212b;
  --red-dark: #a9161e;
  --border: #dedfd8;
  --on-ink: #f4f4f1;
  --shadow: 0 14px 34px -18px rgba(37, 39, 44, 0.28);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
}

h1 {
  margin: 0 0 0.5rem;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hint, .url, .status, .message { color: var(--muted); font-size: 0.95rem; }
.connected {
  color: var(--red);
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.connected.visible { opacity: 1; }

button, .pick, .button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.2rem;
  border: 0;
  border-radius: 14px;
  background: var(--red);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 10px 22px -14px var(--red);
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover,
.pick:hover,
.button-link:hover {
  background: var(--red-dark);
  transform: translateY(-1px);
}

button:active,
.pick:active {
  transform: translateY(0);
}

button:focus-visible,
.pick:focus-within,
.button-link:focus-visible {
  outline: 3px solid rgba(214, 33, 43, 0.35);
  outline-offset: 2px;
}

button.secondary,
.button-link.secondary {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  box-shadow: none;
}

button.secondary:hover,
.button-link.secondary:hover {
  background: var(--ink);
  color: var(--on-ink);
}

button.danger {
  width: 100%;
  margin-top: 1.5rem;
  background: transparent;
  color: var(--red);
  border: 1.5px solid var(--red);
  box-shadow: none;
}

button.danger:hover {
  background: var(--red);
  color: #ffffff;
}

input {
  width: 100%;
  margin: 0.5rem 0 1rem;
  padding: 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1.1rem;
  letter-spacing: 0.12em;
}

input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(214, 33, 43, 0.18);
}

input[type="file"] { display: none; }

/* Tahta */
.board-page { min-height: 100vh; }

.board {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  min-height: 100vh;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1.75rem 1.5rem;
  background: var(--ink);
  color: var(--on-ink);
}

.panel h1 {
  color: var(--on-ink);
}

.panel h1::after {
  content: "";
  display: block;
  width: 44px;
  height: 4px;
  margin-top: 0.6rem;
  border-radius: 2px;
  background: var(--red);
}

.panel .hint,
.panel .url,
.panel .status { color: rgba(244, 244, 241, 0.72); }

.qr {
  width: min(280px, 70vw);
  aspect-ratio: 1;
  margin: 1rem 0;
  padding: 14px;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 16px 34px -14px rgba(0, 0, 0, 0.5);
}

.qr img,
.qr canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.code {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  font-variant-numeric: tabular-nums;
  color: var(--on-ink);
}

.url { word-break: break-all; }

.files { list-style: none; padding: 0; margin: 1rem 0; }
.files li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.files li button { flex: 1; min-width: 0; }
.pick-check {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--red);
  cursor: pointer;
}
.files button {
  width: 100%;
  justify-content: flex-start;
  background: rgba(244, 244, 241, 0.08);
  color: var(--on-ink);
  border: 1px solid rgba(244, 244, 241, 0.2);
  box-shadow: none;
  font-weight: 600;
  word-break: break-all;
  text-align: left;
}
.files button:hover { background: rgba(244, 244, 241, 0.16); transform: none; }

/* Sahne */
.stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  background: var(--cream-2);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  background: var(--ink);
}

.toolbar button.secondary,
.toolbar .button-link.secondary {
  color: var(--on-ink);
  border-color: rgba(244, 244, 241, 0.55);
}

.toolbar button.secondary:hover,
.toolbar .button-link.secondary:hover {
  background: var(--on-ink);
  color: var(--ink);
}

.toolbar button,
.button-link {
  padding: 0.5rem 0.9rem;
  font-size: 0.95rem;
}

.toolbar .position {
  min-width: 4rem;
  text-align: center;
  color: var(--on-ink);
  font-variant-numeric: tabular-nums;
}

.viewer {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  min-width: 0;
  overflow: auto;
}

.viewer img,
.viewer video {
  max-width: 100%;
  max-height: calc(100vh - 3rem);
  border-radius: 12px;
  box-shadow: var(--shadow);
  transform-origin: center;
}

.pdf-canvas {
  max-width: 100%;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.empty { color: var(--muted); }

.viewer .empty {
  padding: 2rem 2.5rem;
  border: 1.5px dashed var(--border);
  border-radius: 18px;
  text-align: center;
}

@media (max-width: 760px) {
  .board { grid-template-columns: 1fr; }
  .stage { min-height: 60vh; }
}

/* Telefon */
.phone-page { padding: 0 16px; }

.phone {
  max-width: 480px;
  margin: 0 auto;
  padding: 2rem 0;
}

.phone h1 {
  font-size: 2rem;
  font-weight: 800;
}

.phone h1::after {
  content: "";
  display: block;
  width: 44px;
  height: 4px;
  margin-top: 0.6rem;
  border-radius: 2px;
  background: var(--red);
}

.card {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.card label {
  display: block;
  font-weight: 700;
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--ink);
}

.pick {
  width: 100%;
  margin-top: 0.5rem;
  padding: 1rem;
  font-size: 1.05rem;
}

.progress {
  height: 10px;
  margin-top: 1rem;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.progress div {
  height: 100%;
  width: 0;
  background: var(--red);
  transition: width 0.15s;
}

.message {
  min-height: 1.5em;
  text-align: center;
}

.remote-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.remote-grid button {
  width: 100%;
  padding: 0.8rem 0.5rem;
  font-size: 0.95rem;
}

.remote-grid button.pressed {
  transform: scale(0.95);
  filter: brightness(0.9);
}

#leave {
  width: 100%;
  margin-top: 1rem;
}

a.button-link { text-decoration: none; }

.chooser .hint { margin-bottom: 1.5rem; }

a.choice {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

a.choice:hover {
  transform: translateY(-2px);
  border-color: var(--ink);
}

a.choice strong { font-size: 1.1rem; font-weight: 800; }
a.choice span { color: var(--muted); font-size: 0.95rem; }

.wordmark {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.wordmark span { color: var(--red); }

.brand-footer {
  margin-top: auto;
  padding-top: 1.5rem;
  font-size: 0.85rem;
  color: rgba(244, 244, 241, 0.6);
  border-top: 1px solid rgba(244, 244, 241, 0.12);
}

.brand-footer .wordmark { color: var(--on-ink); }

.phone .brand-footer {
  margin-top: 2rem;
  color: var(--muted);
  border-top-color: var(--border);
}

.phone .brand-footer .wordmark { color: var(--ink); }
