:root {
  --bg: #f6f1e7;
  --card: #fffdf8;
  --ink: #2b2620;
  --muted: #7a7163;
  --gold: #c9a86a;
  --gold-dark: #8c7853;
  --line: #e4dac6;
  --yes: #3f7f4f;
  --no: #b0413e;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  padding-bottom: env(safe-area-inset-bottom);
}

.app-header {
  background: var(--ink);
  color: #f6f1e7;
  padding: calc(14px + env(safe-area-inset-top)) 16px 14px;
}

.header-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-chip {
  width: 48px; height: 48px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  flex: none;
}

.app-header h1 { margin: 0; font-size: 22px; letter-spacing: .08em; }
.tagline { margin: 0; font-size: 12px; color: #cfc4ab; }

.mode-banner {
  max-width: 720px;
  margin: 10px auto 0;
  background: #4a3f2a;
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 1px 3px rgba(43, 38, 32, .06);
}

.card h2 { margin: 0 0 6px; font-size: 17px; }
.count { font-size: 13px; color: var(--muted); font-weight: normal; }
.hint { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
.msg { margin: 8px 0 0; font-size: 13px; color: var(--gold-dark); min-height: 1.2em; }
.msg.error { color: var(--no); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* --- avatar chip --- */
.avatar {
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.avatar .motif { margin-right: 1px; }

/* --- council picker --- */
.council-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
}

.god-card {
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.god-card .god-portrait {
  width: 76px; height: 76px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--gold);
  background: #efe8d8;
  flex: none;
}
.god-card.selected .god-portrait { box-shadow: 0 0 0 3px #fbf4df, 0 2px 8px rgba(43,38,32,.25); }
.god-card .gname { font-size: 14px; font-weight: 700; }
.god-card .gaxis { font-size: 10.5px; color: var(--muted); line-height: 1.35; }
.god-card.selected { border-color: var(--gold-dark); background: #fbf4df; }
.god-card .seat {
  font-size: 10px; color: var(--gold-dark); min-height: 1.2em; font-weight: 700;
}

/* --- ask form --- */
.current-council {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px;
}
.member-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 10px 3px 4px; font-size: 13px; background: #fff;
}

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

button { font: inherit; cursor: pointer; }
button.primary {
  width: 100%;
  margin-top: 10px;
  background: var(--ink);
  color: #f6f1e7;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .05em;
}
button.primary:disabled { opacity: .5; cursor: wait; }

/* --- deliberation log --- */
.verdict-banner {
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .1em;
  margin-bottom: 12px;
}
.verdict-banner.yes { background: #e7f2e7; color: var(--yes); border: 1px solid var(--yes); }
.verdict-banner.no { background: #f9e8e7; color: var(--no); border: 1px solid var(--no); }
.verdict-banner .sub { display: block; font-size: 12px; font-weight: normal; letter-spacing: 0; margin-top: 2px; }

.phase-title { font-size: 14px; margin: 14px 0 6px; color: var(--gold-dark); }
.phase-title:first-of-type { margin-top: 0; }

.vote-card {
  display: flex; gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  margin-bottom: 8px;
  background: #fff;
  align-items: flex-start;
}
.vote-card .vmain { flex: 1; min-width: 0; }
.vote-card .vhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vote-card .vname { font-weight: 700; font-size: 14px; }
.vote-card .vtext { font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }

.badge {
  font-size: 11px; font-weight: 800;
  border-radius: 999px; padding: 1px 9px;
}
.badge.yes { background: var(--yes); color: #fff; }
.badge.no { background: var(--no); color: #fff; }
.badge.demo { background: var(--gold-dark); color: #fff; }

.persuasion-line { font-size: 14px; }
.persuasion-line .kind { font-size: 11px; color: var(--muted); display: block; }

/* --- report --- */
.report-box {
  margin-top: 14px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
}
.report-box label { font-size: 13.5px; font-weight: 700; display: block; margin-bottom: 6px; }
.report-row { display: flex; gap: 8px; }
.report-row input { flex: 1; }
.report-row button {
  flex: none;
  border: 1px solid var(--gold-dark);
  color: var(--gold-dark);
  background: #fff;
  border-radius: 10px;
  padding: 0 14px;
  font-weight: 700;
}

/* --- archive --- */
.archive-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
  background: #fff;
  overflow: hidden;
}
.archive-item summary {
  list-style: none;
  cursor: pointer;
  padding: 10px;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.archive-item summary::-webkit-details-marker { display: none; }
.archive-item .q { font-weight: 700; font-size: 14px; flex: 1; min-width: 140px; overflow-wrap: anywhere; }
.archive-item .date { font-size: 11px; color: var(--muted); width: 100%; }
.archive-detail { padding: 0 10px 10px; }
.archive-detail .user-action { font-size: 13px; background: #fbf4df; border-radius: 8px; padding: 6px 9px; }
.archive-empty { font-size: 13.5px; color: var(--muted); }
.delete-btn {
  border: none; background: none; color: var(--no);
  font-size: 12px; padding: 4px 0;
}

footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 6px 16px 28px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
