:root {
  color-scheme: light;
  --bg: #e6e0d6;
  --card: #fbf7f1;
  --ink: #1d1a16;
  --muted: #655e55;
  --line: #d8cfc3;
  --accent: #0d6a4c;
  --accent-ink: #f4faf7;
  --warn: #8a3d22;
  --shadow: 0 16px 40px rgba(60, 42, 20, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 400px at 10% -10%, #f3ecdf, transparent 50%),
    var(--bg);
  color: var(--ink);
  font: 17px/1.45 "Avenir Next", "Segoe UI", sans-serif;
}

.sheet {
  width: min(40rem, calc(100% - 2rem));
  margin: 2.5rem auto 3rem;
  padding: 1.6rem 1.5rem 1.4rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.mark {
  margin: 0 0 0.4rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 0.6rem;
  font-family: Palatino, "Palatino Linotype", "Iowan Old Style", Georgia, serif;
  font-size: 2.15rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

h2 {
  margin: 0 0 0.4rem;
  font-family: Palatino, Georgia, serif;
  font-size: 1.7rem;
}

.lead, .hint, .foot, .sum {
  color: var(--muted);
}

.lead { margin: 0 0 1.3rem; }

.hint, .foot, .sum { font-size: 0.92rem; }

.foot { margin: 1.2rem 0 0; }

fieldset {
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
}

legend, .field {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.92rem;
  font-weight: 650;
}

.choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}

.choices label { display: block; }

.choices input { position: absolute; opacity: 0; }

.choices span {
  display: block;
  padding: 0.55rem 0.3rem;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}

.choices input:focus-visible + span,
.drop:focus-visible,
button:focus-visible,
input:focus-visible,
.button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.choices input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

input[type="text"] {
  width: 100%;
  margin: 0 0 0.35rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: inherit;
  font: inherit;
}

.drop {
  margin: 1rem 0 0.6rem;
  padding: 1.4rem 1rem;
  text-align: center;
  border: 1.5px dashed #b7ad9f;
  border-radius: 16px;
  background: #f3eee6;
  cursor: pointer;
}

.drop.is-over { background: #e5f3ec; border-color: var(--accent); }

.drop p { margin: 0; }

.drop input { display: none; }

.files {
  list-style: none;
  margin: 0.4rem 0;
  padding: 0;
}

.files li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
}

.files span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.files em {
  flex: none;
  color: var(--muted);
  font-style: normal;
  font-size: 0.88rem;
}

.bar {
  height: 8px;
  margin: 0.8rem 0 0.4rem;
  overflow: hidden;
  border-radius: 99px;
  background: #e5ddd2;
}

#bar-fill {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
}

.status { min-height: 1.4em; margin: 0.2rem 0 0.8rem; }

.warn {
  margin: 0 0 0.8rem;
  color: var(--warn);
  font-weight: 650;
}

button, .button {
  display: inline-block;
  margin: 0.3rem 0.4rem 0 0;
  padding: 0.72rem 1rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

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

button.ghost, button#copy, button#again {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.linkbox {
  padding: 0.7rem 0.8rem;
  overflow-wrap: anywhere;
  border-radius: 12px;
  background: #f3eee6;
}

.linkbox a { color: var(--accent); }

@media (max-width: 560px) {
  .choices { grid-template-columns: repeat(2, 1fr); }
  h1 { font-size: 1.8rem; }
}
