:root {
  --ink: #111214;
  --paper: #f4f7f3;
  --lime: #d8e54a;
  --gray: #4a5258;
  --line: #c9cfca;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  line-height: 1.6;
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 20px 64px;
}

.org {
  margin: 0;
  font-size: 14px;
  letter-spacing: .08em;
  color: var(--gray);
}

h1 {
  display: inline-block;
  margin: 8px 0 12px;
  padding: 2px 16px;
  background: var(--lime);
  border-radius: 999px;
  font-size: 28px;
}

.steps {
  margin: 0 0 28px;
  padding-left: 1.4em;
}

.slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.pick {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1.58;
  border: 2px dashed var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  text-align: center;
}

.pick:hover, .pick.over { border-color: var(--ink); }

.pick input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.pick img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hint {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  font-size: 14px;
  color: var(--gray);
}

.hint strong {
  font-size: 20px;
  color: var(--ink);
}

.hint em {
  margin-left: 6px;
  font-style: normal;
  font-size: 12px;
  font-weight: 400;
  color: #8a1c12;
}

.hint em.opt { color: var(--gray); }

.tools, .edit-tools, .edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

button {
  padding: 8px 14px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

button:hover { background: var(--lime); }

button:disabled {
  opacity: .5;
  cursor: default;
}

.tools button { flex: 1; }

.error {
  margin: 20px 0 0;
  padding: 12px 16px;
  border-radius: 10px;
  background: #fde8e6;
  color: #8a1c12;
}

.result, .done { margin-top: 36px; }

h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.result img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, .08);
}

form {
  display: grid;
  gap: 14px;
  margin-top: 32px;
}

form label {
  display: grid;
  gap: 4px;
  font-size: 15px;
}

form em {
  margin-left: 6px;
  font-style: normal;
  font-size: 12px;
  color: #8a1c12;
}

input:not([type]), input[type="email"], input[type="tel"], textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--ink);
}

form .check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 14px;
}

.check input { margin-top: 5px; }

.send, .primary {
  padding: 14px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}

.send:hover, .primary:hover { background: #2a2d31; }

.status {
  margin: 0;
  font-size: 14px;
  color: var(--gray);
}

.status.bad { color: #8a1c12; }

.done code {
  padding: 2px 6px;
  border-radius: 6px;
  background: #fff;
}

.note {
  margin-top: 36px;
  font-size: 13px;
  color: var(--gray);
}

dialog {
  width: min(720px, 94vw);
  padding: 16px;
  border: 0;
  border-radius: 16px;
}

dialog::backdrop { background: rgba(17, 18, 20, .6); }

.stage {
  position: relative;
  margin: 0 auto;
  touch-action: none;
  user-select: none;
}

.stage canvas { display: block; }

#quad-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

#quad-shade { fill: rgba(17, 18, 20, .5); }

#quad-line {
  fill: none;
  stroke: var(--lime);
  stroke-width: 2;
}

.corner {
  position: absolute;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
}

.corner::after {
  content: "";
  position: absolute;
  inset: 11px;
  border: 3px solid var(--lime);
  border-radius: 50%;
  background: rgba(17, 18, 20, .6);
}

.corner.active::after { inset: 6px; background: rgba(17, 18, 20, .3); }

.edit-msg {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.5;
}

.edit-msg.warn { color: #8a1c12; font-weight: 700; }

.edit-out {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  font-size: 13px;
  color: var(--gray);
}

#edit-preview {
  width: min(240px, 60vw);
  max-width: min(240px, 60vw);
  height: auto;
  border: 1px solid #dfe3df;
  border-radius: 4px;
}

.stage { overflow: visible; }

.edit-tools {
  flex-wrap: wrap;
  align-items: center;
  margin-top: 14px;
}

.edit-actions {
  justify-content: flex-end;
  margin-top: 14px;
}

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

.terms section { margin-top: 28px; }

.terms h2 {
  padding-bottom: 6px;
  border-bottom: 2px solid var(--line);
  font-size: 18px;
}

.terms p, .terms li { font-size: 15px; }

.terms li + li { margin-top: 6px; }

/* 章程 */
.bylaws-link { margin: 6px 0 0; font-size: 15px; }
.bylaws-note { color: var(--muted, #6b7378); font-size: 14px; }
.bylaws-toc ol { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 15px; }
.bylaws .chapter { scroll-margin-top: 16px; }
.bylaws .article { display: grid; grid-template-columns: 6.5em 1fr; gap: 0 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.bylaws .article h3 { margin: 0; font-size: 15px; font-weight: 700; white-space: nowrap; }
.bylaws .article > :not(h3) { grid-column: 2; margin: 0 0 6px; }
.bylaws .article > :last-child { margin-bottom: 0; }
.bylaws ol.items { list-style: none; padding: 0; }
.bylaws ol.items li { padding-left: 2em; text-indent: -2em; }
.bylaws ol.items li + li { margin-top: 2px; }
.bylaws-end { margin-top: 24px; text-align: center; color: var(--muted, #6b7378); font-size: 14px; }
.bylaws-noprint { display: none; }
@media (max-width: 560px) {
  .bylaws .article { grid-template-columns: 1fr; }
  .bylaws .article h3 { margin-bottom: 4px; }
  .bylaws .article > :not(h3) { grid-column: 1; }
}
@media print {
  .bylaws { display: none; }
  .bylaws-noprint { display: block; margin: 40px; font-size: 16px; }
}

@media (max-width: 560px) {
  main { padding-top: 32px; }
  .slots { grid-template-columns: 1fr; }
}

.tips {
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #dfe3df;
  font-size: 14px;
  line-height: 1.6;
}

.examples {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 8px;
  margin: 8px 0 12px;
}

.examples figure { margin: 0; }

.examples img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 3px solid #2f7d32;
}

.examples .no img { border-color: #8a1c12; }

.examples figcaption {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 700;
  color: #2f7d32;
}

.examples .no figcaption { color: #8a1c12; }

.tips h2 {
  margin: 0 0 6px;
  font-size: 15px;
}

.tips ul {
  margin: 0;
  padding-left: 1.2em;
}

.tips li + li { margin-top: 4px; }

.gate {
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: #fff;
}

.gate .check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 15px;
  cursor: pointer;
}

.gate-hint {
  margin: 6px 0 0 26px;
  font-size: 13px;
  color: #8a1c12;
}

fieldset.slots {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

fieldset.slots:disabled { opacity: .45; }

fieldset.slots:disabled .pick { cursor: not-allowed; }

.terms-dialog h2 { margin-bottom: 8px; }

.terms-body {
  max-height: 60vh;
  overflow-y: auto;
  padding: 0 12px 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
}

.terms-body section:first-child { margin-top: 12px; }

.terms-hint {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--gray);
}

.row {
  display: flex;
  gap: 8px;
}

.row input { flex: 1; min-width: 0; }

.row button { white-space: nowrap; }

.slot.bad .pick {
  border: 2px solid #c0392b;
  background: #fff5f4;
}

/* camera */
.shoot button { flex: 1; }
.camera .cam-stage {
  position: relative;
  width: fit-content;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 10px;
  background: #000;
}
.camera video {
  display: block;
  max-width: 100%;
  max-height: 62vh;
}
.cam-guide {
  position: absolute;
  border: 3px solid var(--lime);
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35);
  pointer-events: none;
}
label.button {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
}
label.button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.camera .edit-actions button, .camera .edit-actions label { flex: 1; justify-content: center; }

/* terms: sub-list of data categories, last-updated line */
.terms ol.sub { margin: 6px 0 0; padding-left: 1.4em; list-style-type: "・"; }
.terms ol.sub li + li { margin-top: 4px; }
.terms-date { color: #6b7378; font-size: 13px; margin: 4px 0 0; }
