:root {
  color-scheme: light;
  --bg: #f8f4ec;
  --surface: #ffffff;
  --ink: #1b1a17;
  --muted: #5f5b52;
  --accent: #d36c2b;
  --accent-strong: #b7541c;
  --accent-soft: #fff0e2;
  --chip: #fff3e6;
  --chip-hidden: #ece6dc;
  --border: #e6dfd6;
  --shadow: 0 26px 60px rgba(27, 26, 23, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Gill Sans", "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #fff6e8 0%, #f9efe2 40%, #f2e8dd 100%);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  z-index: -1;
  opacity: 0.35;
}

body::before {
  top: -120px;
  right: -100px;
  background: radial-gradient(circle, #ffd7b2 0%, rgba(255, 215, 178, 0) 70%);
}

body::after {
  bottom: -140px;
  left: -120px;
  background: radial-gradient(circle, #ffe6bf 0%, rgba(255, 230, 191, 0) 70%);
}

.container {
  width: min(100%, 860px);
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  padding: 22px 0 10px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo {
  font-size: 1.8rem;
  letter-spacing: 0.06em;
  margin: 0;
  text-transform: uppercase;
}

.ghost-button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.ghost-button:hover,
.ghost-button:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.card {
  background: var(--surface);
  border-radius: 28px;
  padding: 26px 20px 30px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(211, 108, 43, 0.08);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 230, 191, 0.45), transparent 60%);
  pointer-events: none;
}

.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.card-header h2 {
  margin: 0;
  font-size: 1.25rem;
  position: relative;
  z-index: 1;
}

.date-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 24px;
  position: relative;
  z-index: 1;
}

.chip {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  background: var(--chip);
  color: var(--ink);
  border: 1px solid rgba(211, 108, 43, 0.2);
}

.chip.hidden {
  background: var(--chip-hidden);
  color: #b7b2aa;
  border: 1px dashed #cbc6bc;
}

.guess-area {
  display: flex;
  gap: 12px;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.guess-field {
  position: relative;
  width: 100%;
}

.guess-area input {
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  font-size: 1rem;
  width: 100%;
  background: #fffaf4;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 20;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fffaf4;
  box-shadow: 0 16px 28px rgba(211, 108, 43, 0.18);
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
}

.suggestion-item {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.95rem;
  cursor: pointer;
}

.suggestion-item:hover,
.suggestion-item:focus-visible {
  background: var(--accent-soft);
  color: var(--accent-strong);
  outline: none;
}

.guess-area input:focus-visible {
  outline: 2px solid rgba(211, 108, 43, 0.35);
  outline-offset: 2px;
}

.primary-button,
.secondary-button {
  border: none;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.primary-button {
  background: var(--accent);
  color: white;
  box-shadow: 0 12px 22px rgba(211, 108, 43, 0.25);
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--accent-strong);
}

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

.secondary-button {
  background: #fff7ec;
  color: var(--ink);
  border: 1px solid var(--border);
}

.secondary-button:hover,
.secondary-button:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.feedback {
  margin: 16px 0 8px;
  min-height: 1.4em;
  color: var(--muted);
  position: relative;
  z-index: 1;
}

.feedback.is-muted {
  visibility: hidden;
}

.history {
  margin-top: 18px;
}

.history h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.history-list li {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff6ea;
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(211, 108, 43, 0.1);
}

.history-list span {
  color: var(--muted);
  font-size: 0.85rem;
}

.result {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 12px;
}

.share-fallback textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 10px;
  font-family: inherit;
}

.site-footer {
  margin-top: auto;
  padding: 20px 0 30px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 10;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.modal-content {
  position: relative;
  background: var(--surface);
  border-radius: 20px;
  padding: 20px;
  width: min(92%, 420px);
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.icon-button {
  border: none;
  background: transparent;
  font-size: 1.4rem;
  cursor: pointer;
}

.modal-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  display: grid;
  gap: 6px;
}

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

@media (min-width: 640px) {
  .logo {
    font-size: 2.1rem;
  }

  .card {
    padding: 34px;
  }

  .guess-area {
    flex-direction: row;
  }

  .guess-area input {
    flex: 1;
  }

  .primary-button {
    min-width: 140px;
  }
}

@media (min-width: 900px) {
  .card-header h2 {
    font-size: 1.5rem;
  }

  .chip {
    font-size: 1rem;
  }
}
