:root {
  --paper: #fbfaf7;
  --panel: #fffefa;
  --ink: #111110;
  --muted: #746f67;
  --hairline: #d8d1c6;
  --accent: #bd5537;
  --accent-hover: #a94c32;
  --soft: #f4f0ea;
  --status-green: #5d775c;
  --status-amber: #ad753b;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Helvetica Neue", Arial, "Pretendard", "Noto Sans KR", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 74px;
  padding: 0 32px;
}

.wordmark {
  font-family: "Bodoni 72", Didot, "Bodoni MT", "Times New Roman", serif;
  font-size: 37px;
  line-height: 1;
  letter-spacing: -0.02em;
}

.back-link {
  padding-bottom: 4px;
  border-bottom: 1px solid var(--ink);
  font-size: 12px;
}

.history-page {
  display: grid;
  min-height: calc(100vh - 74px);
  padding: 46px 24px 74px;
  place-items: start center;
}

.history-panel {
  width: min(1080px, 100%);
}

.history-heading {
  padding-bottom: 26px;
  border-bottom: 1px solid var(--hairline);
}

.history-heading h1 {
  margin: 0;
  font-family: Georgia, "Noto Serif KR", "Times New Roman", serif;
  font-size: 50px;
  font-weight: 400;
  line-height: 1.18;
}

.history-heading p {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.history-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.history-filter {
  min-width: 68px;
  height: 38px;
  padding: 0 18px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

.history-filter:hover,
.history-filter.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.history-list {
  display: grid;
  gap: 14px;
  margin-top: 32px;
}

.history-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  min-height: 116px;
  padding: 23px 30px 22px 24px;
  border: 1px solid var(--hairline);
  border-radius: 7px;
  background: var(--panel);
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(28, 22, 16, 0.025);
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

.history-card:hover,
.history-card:focus-visible {
  border-color: #c8bdae;
  background: #fffdf8;
  outline: 0;
}

.history-card-main {
  min-width: 0;
}

.history-type {
  display: block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.history-card h2 {
  margin: 12px 0 0;
  overflow: hidden;
  font-family: Georgia, "Noto Serif KR", "Times New Roman", serif;
  font-size: 26px;
  font-weight: 400;
  line-height: 1.24;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-meta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  width: 100%;
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.history-delete-button {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 1px;
  transition:
    color 160ms ease;
}

.history-delete-button:hover {
  color: var(--accent);
}

.history-card-side {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-left: 12px;
}

.history-status {
  display: inline-grid;
  min-width: 94px;
  height: 30px;
  padding: 0 16px;
  border-radius: 999px;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.history-status.is-pending {
  background: var(--status-amber);
}

.history-status.is-answered {
  background: var(--status-green);
}

.history-arrow {
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  line-height: 1;
}

.history-empty {
  padding: 72px 0 64px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  text-align: center;
}

.history-modal {
  position: fixed;
  z-index: 50;
  display: grid;
  inset: 0;
  min-height: 100dvh;
  padding: 24px;
  opacity: 0;
  place-items: center;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.history-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.history-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(17, 17, 16, 0.3);
  cursor: default;
}

.history-modal-panel {
  position: relative;
  width: min(420px, calc(100vw - 40px));
  max-height: calc(100dvh - 48px);
  overflow: auto;
  padding: 36px 34px 30px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(22, 18, 14, 0.18);
  text-align: center;
}

.history-modal-panel h2 {
  margin: 0;
  font-family: Georgia, "Noto Serif KR", "Times New Roman", serif;
  font-size: 25px;
  font-weight: 400;
  line-height: 1.35;
}

.history-modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
}

.history-modal-button {
  display: inline-grid;
  min-width: 96px;
  height: 42px;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  place-items: center;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

.history-modal-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.history-modal-button.is-delete {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.history-modal-button.is-delete:hover {
  background: var(--accent-hover);
  color: #fff;
}

@media (max-width: 760px) {
  .site-header {
    height: 64px;
    padding: 0 18px;
  }

  .wordmark {
    font-size: 30px;
  }

  .history-page {
    min-height: calc(100vh - 64px);
    padding: 34px 20px 58px;
  }

  .history-heading h1 {
    font-size: 38px;
  }

  .history-heading p {
    font-size: 14px;
  }

  .history-tabs {
    gap: 8px;
    margin-top: 24px;
  }

  .history-filter {
    min-width: auto;
    height: 36px;
    padding: 0 14px;
    font-size: 12px;
  }

  .history-card {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 20px 18px;
  }

  .history-card h2 {
    font-size: 22px;
  }

  .history-card-side {
    justify-content: space-between;
    padding-left: 0;
  }

  .history-modal-actions {
    flex-direction: column;
  }

  .history-modal-button {
    width: 100%;
  }
}
