:root {
  color-scheme: light;
  --bg: #f4f6f1;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #6d7680;
  --line: #d7ded3;
  --green: #0f7a5f;
  --green-soft: #e4f3ec;
  --blue: #245f9f;
  --red: #a33a3a;
  --shadow: 0 18px 34px rgba(23, 33, 43, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 44px;
  padding: 0 14px;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

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

button.ghost {
  background: #f8faf6;
}

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

button.icon {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  font-size: 32px;
  line-height: 1;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input {
  height: 50px;
  padding: 0 13px;
}

textarea {
  min-height: 290px;
  padding: 15px;
  resize: vertical;
  line-height: 1.55;
  font-size: 17px;
}

input:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(15, 122, 95, 0.12);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.hidden {
  display: none !important;
}

.phone {
  width: min(100vw, 430px);
  min-height: 100vh;
  padding: max(16px, env(safe-area-inset-top)) 14px max(20px, env(safe-area-inset-bottom));
}

.admin-phone {
  width: min(100vw, 480px);
}

.screen {
  display: grid;
  gap: 14px;
}

.card,
.entry-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.pad {
  padding: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px 8px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 900;
}

h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.2;
}

p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 4px 14px 0;
  padding: 4px;
  border-radius: 8px;
  background: #edf1eb;
}

.segmented button {
  border: 0;
  min-height: 38px;
  background: transparent;
}

.segmented button.active {
  background: #fff;
  box-shadow: 0 2px 8px rgba(23, 33, 43, 0.08);
}

.form {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.wide {
  width: 100%;
}

.pin-box {
  margin: 0 14px 14px;
  padding: 14px;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  text-align: center;
}

.pin-box span {
  display: block;
  font-size: 13px;
  font-weight: 900;
}

.pin-box strong {
  display: block;
  margin-top: 6px;
  font-size: 36px;
  letter-spacing: 0;
}

.appbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 2px 2px 0;
}

.appbar strong,
.appbar span {
  display: block;
}

.appbar span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.datebar {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.datebar div {
  min-width: 0;
  text-align: center;
}

.datebar strong {
  display: block;
  font-size: 22px;
}

.datebar span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.entry-card {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.entry-card textarea:disabled {
  background: #f8faf6;
  color: #5b6470;
}

.entry-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  word-break: keep-all;
}

.badge {
  display: inline-block;
  margin-left: 7px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fdf1e0;
  color: #9a6414;
  font-size: 11px;
  font-weight: 900;
  vertical-align: 2px;
}

.admin-link,
.text-link {
  display: block;
  color: var(--green);
  text-align: center;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-row div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.stat-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.stat-row strong {
  display: block;
  margin-top: 4px;
  font-size: 26px;
}

.list {
  display: grid;
  gap: 10px;
}

.person {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 13px;
  box-shadow: 0 8px 20px rgba(23, 33, 43, 0.07);
}

.person strong {
  display: block;
  margin-bottom: 8px;
}

.person pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: keep-all;
  overflow-wrap: anywhere;
  color: #26313c;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
}

.empty {
  border: 1px dashed #b8c3b5;
  border-radius: 8px;
  background: #fff;
  padding: 28px 14px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.summary {
  min-height: 220px;
  font-size: 14px;
  background: #fbfcfa;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.member-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.member-head button {
  min-height: 36px;
  font-size: 13px;
}

.member-list {
  display: grid;
}

.member-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  border-top: 1px solid var(--line);
}

.member-del {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
  color: var(--red);
  border-color: #e3c8c8;
}

.member-del.danger {
  color: #fff;
}

.member-row:first-child {
  border-top: 0;
}

.member-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pin-cell {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
}

.member-date {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.canvas-panel {
  display: grid;
  place-items: center;
  padding: 10px;
}

canvas {
  width: min(100%, 360px);
  aspect-ratio: 9 / 16;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 34px rgba(23, 33, 43, 0.15);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(16px);
  max-width: calc(100vw - 28px);
  border-radius: 8px;
  background: #17212b;
  color: #fff;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 10;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 720px) {
  body {
    align-items: flex-start;
  }

  .phone {
    padding-top: 26px;
  }
}

