:root {
  --ink: #111;
  --paper: #fff;
  --panel: #fff;
  --line: #e0e0e0;
  --accent: #ba0000;
  --accent-soft: #d64545;
  --accent-hover: #8f0000;
  --btn-height: 2.5rem;
  --muted: #666;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }

/* Author display rules (e.g. .field { display: flex }) otherwise beat [hidden] */
[hidden] {
  display: none !important;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: "Roboto Mono", ui-monospace, monospace;
}

.page {
  width: min(640px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 1.5rem;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.panel {
  flex: 0 0 auto;
}

.brand { margin-bottom: 1.25rem; }

.logo {
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.logo span { color: var(--accent); }

.tagline {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
  padding: 1.25rem 1.15rem 1.35rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
  width: 100%;
}

.field.compact {
  margin-bottom: 0;
  flex: 1;
  min-width: 5rem;
}

.lang-fallback {
  margin-bottom: 1rem;
  max-width: 8rem;
}

.field span {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

input, select, textarea {
  font: inherit;
  font-size: 0.9rem;
  height: var(--btn-height);
  padding: 0 0.8rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  width: 100%;
  line-height: 1.3;
}

textarea {
  height: auto;
  padding: 0.7rem 0.8rem;
  resize: vertical;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, white);
  border-color: var(--accent);
}

.mono { font-family: "Roboto Mono", ui-monospace, monospace; }

.row {
  display: flex;
  gap: 0.75rem;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.row > .btn,
.row > a.btn {
  flex: 0 0 auto;
}

.btn {
  appearance: none;
  border: none;
  background: #111;
  color: #fff;
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 0.85rem;
  font-weight: 700;
  height: var(--btn-height);
  min-height: var(--btn-height);
  padding: 0 1.15rem;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: background 0.15s ease, color 0.15s ease;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
}

.btn.primary:hover {
  background: var(--accent-hover);
  color: #fff;
}

.btn:hover {
  background: #333;
}

.btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.btn.ghost {
  background: transparent;
  color: var(--accent);
  box-shadow: none;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0 0.75rem;
}

.btn.ghost:hover {
  background: transparent;
  color: var(--accent-hover);
  text-decoration: underline;
}

.status {
  font-size: 0.85rem;
  color: var(--accent);
  margin: 0 0 1rem;
}

.status.ok { color: #2e7d32; }

.result {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  margin-top: 0.5rem;
}

.result h2 {
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
  font-weight: 700;
}

.win-actions {
  margin-top: 0.15rem;
}

.win-actions .row {
  margin-bottom: 0;
  gap: 0.65rem;
}

.btn .ext-arrow {
  margin-left: 0.4em;
  font-size: 1.05em;
  font-weight: 700;
  line-height: 1;
  transform: translateY(-0.02em);
}

#riddle.is-solved .summary {
  margin-bottom: 1.15rem;
}

#riddle.is-solved .win-actions {
  animation: win-in 0.28s ease-out;
}

@keyframes win-in {
  from {
    opacity: 0;
    transform: translateY(0.35rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.muted { color: var(--muted); line-height: 1.45; }

.title-mask {
  font-size: clamp(1.1rem, 3vw, 1.45rem);
  letter-spacing: 0;
  margin: 0 0 1rem;
  word-break: break-word;
  font-weight: 700;
}

.summary {
  line-height: 1.55;
  margin: 0 0 1.4rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Censored segments must be monospace so underscore length = letter count */
.mask {
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 0.95em;
  letter-spacing: 0;
  white-space: pre;
}

/* One underline per letter (text-decoration merges across adjacent spans) */
.revealed {
  display: inline-block;
  padding: 0 0.02em 0.12em;
  margin: 0 0.04em;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: 92% 1.5px;
}

#share-url { flex: 1; min-width: 12rem; }

a:not(.btn):not(.logo) {
  color: var(--accent);
}

.guess-form .row {
  margin-bottom: 0;
}

.site-footer {
  margin-top: auto;
  padding-top: 2rem;
  text-align: center;
  font-size: 0.75rem;
}

.site-footer a:not(.btn):not(.logo) {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:not(.btn):not(.logo):hover {
  color: var(--ink);
  text-decoration: underline;
}

@media (max-width: 560px) {
  .row {
    align-items: stretch;
    flex-direction: column;
  }

  .row .btn,
  .row a.btn,
  .row .field.compact {
    width: 100%;
  }

  .row .field.compact {
    flex: none;
  }
}
