:root {
  --parchment: #f3eee2;
  --ink: #231f16;
  --muted: #6d6656;
  --accent: #8f3f2f;
  --card: #fbf7ef;
  --shadow: rgba(35, 31, 22, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background: radial-gradient(
    circle at top right,
    #efe4cf 0%,
    var(--parchment) 45%,
    #e8deca 100%
  );
  min-height: 100vh;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image: radial-gradient(
    rgba(35, 31, 22, 0.06) 0.5px,
    transparent 0.5px
  );
  background-size: 3px 3px;
  opacity: 0.18;
}

.layout {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 3rem 1.2rem 4rem;
}

.hero {
  text-align: center;
  margin-bottom: 2rem;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  color: var(--muted);
}

h1 {
  margin: 0.2rem 0 0;
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 600;
}

.subhead {
  margin: 0.8rem auto 0;
  max-width: 620px;
  color: var(--muted);
  line-height: 1.45;
}

.card,
.oracle {
  background: var(--card);
  border: 1px solid rgba(35, 31, 22, 0.12);
  border-radius: 16px;
  box-shadow: 0 12px 28px -16px var(--shadow);
}

.card {
  padding: 1.1rem;
}

label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--muted);
}

textarea {
  width: 100%;
  border: 1px solid rgba(35, 31, 22, 0.22);
  border-radius: 10px;
  padding: 0.8rem;
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
  min-height: 84px;
  background: #fffdf8;
}

select {
  width: 100%;
  border: 1px solid rgba(35, 31, 22, 0.22);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  font-family: inherit;
  font-size: 0.98rem;
  background: #fffdf8;
  color: var(--ink);
  margin-top: 0.1rem;
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(143, 63, 47, 0.14);
}

select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(143, 63, 47, 0.14);
}

.actions {
  margin-top: 0.8rem;
  display: flex;
  justify-content: flex-end;
}

button {
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: progress;
}

.book-note {
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.usage-note {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.oracle {
  margin-top: 1.2rem;
  padding: 1.2rem;
}

.oracle-label {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

blockquote {
  margin: 0.7rem 0 0;
  font-size: 1.35rem;
  line-height: 1.45;
}

.oracle-meta {
  margin: 0.8rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.oracle-actions {
  margin-top: 0.65rem;
  display: flex;
  gap: 0.45rem;
}

.history {
  margin-top: 1.2rem;
  background: var(--card);
  border: 1px solid rgba(35, 31, 22, 0.12);
  border-radius: 16px;
  box-shadow: 0 12px 28px -16px var(--shadow);
  padding: 1rem 1rem 0.9rem;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.history-label {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(143, 63, 47, 0.32);
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

#historyList {
  margin: 0.7rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.65rem;
}

.history-item {
  border: 1px solid rgba(35, 31, 22, 0.12);
  border-radius: 10px;
  padding: 0.65rem 0.7rem;
  background: #fffdf8;
}

.history-question {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.history-sentence {
  margin: 0.32rem 0 0;
  font-size: 1rem;
  line-height: 1.4;
}

.history-meta {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.history-actions {
  margin-top: 0.55rem;
  display: flex;
  gap: 0.45rem;
}

.tiny {
  padding: 0.32rem 0.62rem;
  font-size: 0.76rem;
}

.history-empty {
  margin: 0.8rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.history-empty.hidden {
  display: none;
}

@media (max-width: 640px) {
  .layout {
    padding-top: 2rem;
  }

  blockquote {
    font-size: 1.18rem;
  }
}
