:root {
  --ink: #f4f3ee;
  --ink-dim: rgba(244, 243, 238, 0.72);
  --glass-bg: rgba(10, 14, 20, 0.46);
  --glass-border: rgba(244, 243, 238, 0.22);
  --accent: #7fe7c4;
  --accent-warn: #ff8a65;
  --ui-font: -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: var(--ui-font);
  color: var(--ink);
}

#canvas {
  position: relative;
  width: 100vw;
  height: 100vh;
  background-color: #0b0d12;
  background-image: linear-gradient(180deg, rgba(5, 7, 12, 0.55) 0%, rgba(5, 7, 12, 0.15) 30%, rgba(5, 7, 12, 0.15) 70%, rgba(5, 7, 12, 0.55) 100%),
    var(--bg-image, none);
  background-size: cover;
  background-position: center;
  transition: background-image 0.8s ease;
}

/* --- Gedeelde widget-look: een dunne "dradenkruis"-rand, geinspireerd op
   telescoopoptiek, als terugkerend visueel element van ScreenLab --- */
.widget {
  position: absolute;
}

.widget__frame {
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 18px 22px;
}

.widget__frame::before,
.widget__frame::after,
.widget__frame > .widget__frame::before {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--accent);
  opacity: 0.85;
}
.widget__frame::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
  border-top-left-radius: 4px;
}
.widget__frame::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
  border-bottom-right-radius: 4px;
}

/* --- Timer widget: bovenin, horizontaal gecentreerd --- */
.widget--timer {
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
}

.timer__display {
  font-family: "Courier New", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 56px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 2px;
  line-height: 1;
  min-width: 4ch;
}

.timer__display.is-running {
  color: var(--accent);
}

.timer__display.is-zero {
  color: var(--accent-warn);
}

.timer__controls {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.timer__set {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-dim);
}

.timer__set input {
  width: 56px;
}

/* --- Vrije tekst widget: volledig gecentreerd (horizontaal + verticaal) --- */
.widget--text {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: min(80vw, 900px);
}

.widget__frame--text {
  min-width: 260px;
}

.text__content {
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  font-size: var(--text-size, 20px);
  color: var(--ink);
  text-align: center;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
  min-width: 40px;
  min-height: 1.4em;
}

.text__content:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-dim);
}

.text__toolbar {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  font-size: 12px;
  color: var(--ink-dim);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.widget--text:hover .text__toolbar,
.widget--text:focus-within .text__toolbar {
  opacity: 1;
}

.text__toolbar label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.text__toolbar input {
  width: 56px;
}

/* --- Formulierelementen --- */
input[type="number"] {
  background: rgba(244, 243, 238, 0.1);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  color: var(--ink);
  padding: 4px 6px;
  font-family: var(--ui-font);
}

.btn {
  font-family: var(--ui-font);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: rgba(244, 243, 238, 0.12);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn:hover {
  background: rgba(244, 243, 238, 0.22);
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: var(--accent);
  color: #05261c;
  border-color: var(--accent);
}

.btn--primary:hover {
  background: #96f0d3;
}

.btn--primary.is-running {
  background: var(--accent-warn);
  border-color: var(--accent-warn);
  color: #2b0f06;
}

#background-credit {
  position: absolute;
  bottom: 10px;
  left: 14px;
  max-width: 60vw;
}

.credit-link {
  font-size: 12px;
  color: var(--ink-dim);
  text-decoration: underline;
  cursor: pointer;
}

.credit-link:hover {
  color: var(--ink);
}

.background-explanation {
  margin-top: 8px;
  max-width: min(70vw, 640px);
  max-height: 50vh;
  overflow-y: auto;
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 14px 18px;
}

.hidden {
  display: none;
}
