/* 色はアプリ（lib/ui/theme.dart）と同じ。 */
:root {
  --bg: #fbf6ec;
  --surface: #fffdf7;
  --primary: #e8a13d;
  --ink: #5b4a3f;
  --ink-faint: rgba(91, 74, 63, 0.6);
  --ink-hint: rgba(91, 74, 63, 0.4);
  --line: rgba(91, 74, 63, 0.18);
  --danger: #c8473a;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 900;
}

nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 16px 16px 96px;
}

h1 {
  font-size: 20px;
  margin: 16px 0;
}

h2 {
  font-size: 17px;
  margin: 0 0 8px;
}

a {
  color: var(--ink);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.narrow {
  max-width: 400px;
  margin: 48px auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.center {
  text-align: center;
}

.muted {
  color: var(--ink-faint);
}

.small {
  font-size: 12px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.row.between {
  justify-content: space-between;
}

.row.end {
  justify-content: flex-end;
}

.links {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 13px;
  margin: 0;
}

button {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: var(--ink-faint);
}

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

button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
}

button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

button.text {
  border-color: transparent;
  background: none;
  padding: 6px 10px;
}

button.wide {
  width: 100%;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.page-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

label {
  display: block;
  margin-bottom: 12px;
}

.label {
  display: block;
  font-size: 12px;
  color: var(--ink-faint);
  margin-bottom: 4px;
}

input[type="text"],
textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

::placeholder {
  color: var(--ink-hint);
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}

.segmented label {
  margin: 0;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: block;
  padding: 6px 16px;
  cursor: pointer;
}

.segmented input:checked + span {
  background: var(--primary);
  color: #fff;
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 16px 0;
  white-space: pre-line;
  font-size: 14px;
}

.check input {
  margin-top: 4px;
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, 84px);
  gap: 8px;
  margin: 4px 0 12px;
}

.page-card {
  position: relative;
  width: 84px;
  height: 120px;
  border-radius: 4px;
  background: #fff;
  border: 1px solid var(--line);
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}

.page-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.page-card.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  border-style: dashed;
}

.page-card.later {
  opacity: 0.35;
  cursor: default;
}

.page-card.over {
  outline: 2px solid var(--primary);
}

.page-card .plus {
  font-size: 28px;
  color: var(--ink-faint);
}

.page-card .number {
  position: absolute;
  left: 4px;
  top: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.page-card .remove {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  line-height: 22px;
  font-size: 14px;
}

.busy {
  pointer-events: none;
}

progress {
  width: 100%;
  margin-bottom: 12px;
  accent-color: var(--primary);
}

.episodes {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.episodes li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}

.grow {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.chip {
  flex: none;
  font-size: 12px;
  padding: 1px 10px;
  border-radius: 999px;
  background: var(--line);
}

.chip.published {
  background: var(--primary);
  color: #fff;
}

.chip.rejected,
.chip.hidden {
  background: var(--danger);
  color: #fff;
}

#snack {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 8px;
  background: #3b2d24;
  color: #fff;
}

#snack[hidden] {
  display: none;
}

#snack button {
  color: var(--primary);
  font-weight: 700;
}

dialog {
  border: none;
  border-radius: 12px;
  padding: 20px;
  max-width: min(420px, calc(100% - 32px));
  background: var(--surface);
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

.dialog-title {
  font-weight: 700;
  margin-top: 0;
}
