:root {
  color-scheme: light;
  --ink: #292722;
  --muted: #837e74;
  --line: rgba(64, 59, 50, 0.12);
  --paper: #f7f4ed;
  --white: #fffdf8;
  --orange: #d96f4c;
  --orange-dark: #bb5535;
  --green: #7c9270;
  --gold: #c89b4c;
  --violet: #7d789d;
  --shadow: 0 22px 60px rgba(64, 52, 37, 0.1);
  font-family: "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 4%, rgba(217, 111, 76, 0.13), transparent 28rem),
    radial-gradient(circle at 94% 18%, rgba(124, 146, 112, 0.14), transparent 26rem),
    var(--paper);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(217, 111, 76, 0.28);
  outline-offset: 2px;
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 64px 0 80px;
}

.home-page-link {
  display: flex;
  justify-content: flex-end;
  margin: -24px 4px 24px;
}

.home-page-link a {
  padding-bottom: 4px;
  border-bottom: 1px solid currentColor;
  color: var(--orange-dark);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 42px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  color: var(--orange);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.hero h1 {
  margin: 0;
  font-family: "Gowun Dodum", "Noto Sans KR", sans-serif;
  font-size: clamp(42px, 6vw, 72px);
  font-weight: 400;
  line-height: 1.14;
  letter-spacing: -0.055em;
}

.hero h1 span {
  color: var(--orange);
}

.hero-copy {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.85;
}

.round-badge {
  display: grid;
  width: 124px;
  height: 124px;
  flex: 0 0 auto;
  place-content: center;
  margin-top: 24px;
  border: 1px solid rgba(217, 111, 76, 0.22);
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.65);
  text-align: center;
  box-shadow: 0 12px 32px rgba(107, 75, 55, 0.08);
}

.round-badge span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.round-badge strong {
  display: block;
  color: var(--orange);
  font-family: "Gowun Dodum", sans-serif;
  font-size: 42px;
  font-weight: 400;
  line-height: 1.05;
}

.control-card,
.history-section {
  padding: 34px;
  border: 1px solid rgba(64, 59, 50, 0.07);
  border-radius: 28px;
  background: rgba(255, 253, 248, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.section-heading,
.history-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.section-heading h2,
.history-heading h2 {
  margin: 0;
  font-family: "Gowun Dodum", "Noto Sans KR", sans-serif;
  font-size: 29px;
  font-weight: 400;
  letter-spacing: -0.04em;
}

.attendance-summary {
  color: var(--muted);
  font-size: 13px;
}

.member-heading-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.list-toggle-button {
  min-width: 104px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #746f66;
  background: #f3efe6;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.list-toggle-button:hover {
  color: var(--orange-dark);
  background: #ebe5da;
}

.list-toggle-button span {
  margin-left: 4px;
}

.member-management[hidden] {
  display: none;
}

.attendance-summary strong {
  color: var(--ink);
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--green);
}

.summary-divider {
  margin: 0 5px;
  color: #c2bdb3;
}

.entry-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 26px;
}

.entry-row textarea {
  min-width: 0;
  min-height: 94px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: #fff;
  line-height: 1.65;
  resize: vertical;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.entry-row textarea::placeholder {
  color: #aaa49a;
}

.entry-row textarea:focus {
  border-color: rgba(217, 111, 76, 0.5);
  box-shadow: 0 8px 24px rgba(217, 111, 76, 0.08);
}

.entry-row .secondary-button {
  min-width: 104px;
}

.entry-help {
  margin: 8px 4px 0;
  color: #9b958b;
  font-size: 11px;
}

.secondary-button,
.primary-button,
.danger-button {
  border: 0;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.secondary-button {
  min-width: 84px;
  padding: 0 20px;
  border: 1px solid var(--line);
  background: #f3efe6;
}

.secondary-button:hover {
  background: #ebe5da;
}

.member-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.member-list:empty {
  display: none;
}

.member-item {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  transition: opacity 160ms ease, background 160ms ease;
}

.member-item.is-absent {
  opacity: 0.56;
  background: #f1eee8;
}

.member-item.is-absent .member-name {
  text-decoration: line-through;
}

.member-avatar,
.group-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: white;
  font-weight: 800;
}

.member-avatar {
  width: 34px;
  height: 34px;
  background: var(--orange);
  font-size: 13px;
}

.member-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.absence-button,
.remove-button {
  border: 0;
  cursor: pointer;
}

.absence-button {
  padding: 5px 9px;
  border-radius: 999px;
  color: #8b6559;
  background: #faece7;
  font-size: 11px;
  font-weight: 700;
}

.is-absent .absence-button {
  color: #fff;
  background: var(--orange);
}

.remove-button {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  color: #aaa49a;
  background: transparent;
  font-size: 18px;
  line-height: 1;
}

.remove-button:hover {
  color: var(--orange-dark);
  background: #f8e9e4;
}

.empty-members {
  padding: 38px 20px 32px;
  text-align: center;
}

.empty-members[hidden] {
  display: none;
}

.empty-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  margin: 0 auto 12px;
  border: 1px dashed #bbb5aa;
  border-radius: 50%;
  color: #9c958b;
  font-size: 24px;
}

.empty-members p {
  margin: 0;
  color: #746f66;
  font-size: 14px;
  font-weight: 600;
}

.empty-members small {
  color: #aaa49a;
  font-size: 12px;
}

.control-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px dashed rgba(64, 59, 50, 0.16);
}

.control-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.primary-button {
  display: flex;
  min-width: 184px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 19px 16px 22px;
  color: #fff;
  background: var(--orange);
  box-shadow: 0 10px 25px rgba(217, 111, 76, 0.25);
}

.primary-button:hover {
  transform: translateY(-2px);
  background: var(--orange-dark);
  box-shadow: 0 14px 30px rgba(217, 111, 76, 0.3);
}

.primary-button:active,
.secondary-button:active,
.danger-button:active {
  transform: translateY(1px);
}

.results-section {
  margin-top: 58px;
}

.results-section[hidden] {
  display: none;
}

.results-heading {
  margin-bottom: 22px;
}

.result-message {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.groups-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.group-card {
  --group-color: var(--orange);
  --group-bg: #f5ecdc;
  display: flex;
  min-height: 328px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(64, 59, 50, 0.05);
  border-radius: 27px;
  background: var(--group-bg);
  box-shadow: 0 18px 45px rgba(67, 57, 45, 0.07);
  animation: card-in 420ms both;
}

.group-card:nth-child(4n + 1) {
  --group-color: var(--orange);
  --group-bg: #f4ecdc;
}

.group-card:nth-child(4n + 2) {
  --group-color: var(--green);
  --group-bg: #e9ede5;
}

.group-card:nth-child(4n + 3) {
  --group-color: var(--gold);
  --group-bg: #f5e8d8;
}

.group-card:nth-child(4n + 4) {
  --group-color: var(--violet);
  --group-bg: #e9e7ef;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.group-card-main {
  flex: 1;
  padding: 25px 25px 18px;
}

.group-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  color: #777168;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.group-card-header strong {
  letter-spacing: -0.02em;
}

.group-members {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px 18px;
}

.group-member {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.group-avatar {
  width: 38px;
  height: 38px;
  background: var(--group-color);
  font-size: 14px;
}

.group-member strong {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-card-footer {
  padding: 14px 25px;
  border-top: 1px dashed rgba(64, 59, 50, 0.14);
  color: #999287;
  font-size: 12px;
}

.history-section {
  margin-top: 58px;
}

.text-button {
  padding: 8px 2px;
  border: 0;
  border-bottom: 1px solid currentColor;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.text-button:hover {
  color: var(--orange-dark);
}

.history-list {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.history-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 18px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.history-meta {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.65;
}

.history-meta strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.history-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.history-group {
  padding: 7px 10px;
  border-radius: 9px;
  color: #6f695f;
  background: #f0ece3;
  font-size: 11px;
}

.empty-history {
  margin: 24px 0 0;
  padding: 24px 0 4px;
  border-top: 1px solid var(--line);
  color: #aaa49a;
  font-size: 13px;
  text-align: center;
}

.toast {
  position: fixed;
  z-index: 10;
  right: 24px;
  bottom: 24px;
  max-width: min(390px, calc(100vw - 48px));
  padding: 13px 17px;
  border-radius: 13px;
  color: #fff;
  background: #35322d;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.confirm-dialog {
  width: min(430px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: var(--white);
  box-shadow: 0 30px 80px rgba(36, 30, 24, 0.25);
}

.confirm-dialog::backdrop {
  background: rgba(42, 38, 33, 0.4);
  backdrop-filter: blur(5px);
}

.confirm-dialog form {
  padding: 34px;
  text-align: center;
}

.dialog-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  margin: 0 auto 15px;
  border-radius: 50%;
  color: var(--orange);
  background: #f8e9e4;
  font-size: 25px;
}

.confirm-dialog h2 {
  margin: 0;
  font-family: "Gowun Dodum", sans-serif;
  font-size: 25px;
  font-weight: 400;
}

.confirm-dialog p {
  margin: 12px 0 26px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dialog-actions button {
  min-height: 48px;
}

.danger-button {
  color: white;
  background: var(--orange);
}

.danger-button:hover {
  background: var(--orange-dark);
}

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

@media (max-width: 820px) {
  .page-shell {
    width: min(100% - 28px, 680px);
    padding-top: 38px;
  }

  .hero h1 {
    font-size: clamp(40px, 10vw, 58px);
  }

  .round-badge {
    width: 100px;
    height: 100px;
  }

  .round-badge strong {
    font-size: 34px;
  }

  .member-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .groups-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: min(100% - 20px, 480px);
    padding: 28px 0 52px;
  }

  .hero {
    gap: 12px;
    margin-bottom: 28px;
  }

  .hero-copy,
  .desktop-only {
    display: none;
  }

  .hero h1 {
    font-size: 35px;
  }

  .round-badge {
    width: 78px;
    height: 78px;
    margin-top: 8px;
  }

  .round-badge strong {
    font-size: 27px;
  }

  .round-badge span {
    font-size: 8px;
  }

  .control-card,
  .history-section {
    padding: 23px 18px;
    border-radius: 22px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .section-heading h2,
  .history-heading h2 {
    font-size: 25px;
  }

  .member-heading-actions {
    width: 100%;
    justify-content: space-between;
  }

  .entry-row {
    grid-template-columns: 1fr 88px;
  }

  .entry-row .secondary-button {
    min-width: 0;
    padding: 0 8px;
    font-size: 12px;
  }

  .member-list {
    grid-template-columns: 1fr;
  }

  .control-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button {
    width: 100%;
  }

  .results-section,
  .history-section {
    margin-top: 40px;
  }

  .results-heading {
    align-items: flex-start;
  }

  .result-message {
    text-align: left;
  }

  .group-card {
    min-height: 300px;
  }

  .group-members {
    grid-template-columns: 1fr;
  }

  .history-row {
    grid-template-columns: 1fr;
    gap: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
