@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700;800&family=Playfair+Display:wght@600;700&display=swap");

:root {
  color-scheme: light;
  --bg: #f6f1ea;
  --bg-accent: #f3e3cd;
  --ink: #1d1a16;
  --muted: #6b6258;
  --primary: #d8583f;
  --primary-dark: #b14631;
  --panel: #fffaf2;
  --shadow: rgba(20, 16, 12, 0.12);
  --radius-lg: 28px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, var(--bg-accent), var(--bg));
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 60px;
  position: relative;
  overflow-x: hidden;
}

.noise {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  pointer-events: none;
  mix-blend-mode: multiply;
}

.page {
  width: min(960px, 100%);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.hero {
  text-align: left;
  animation: fadeUp 0.8s ease-out both;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
}

.hero h1 {
  font-family: "Playfair Display", "Times New Roman", serif;
  font-size: clamp(32px, 5vw, 56px);
  margin: 0 0 12px;
}

.lead {
  font-size: clamp(16px, 2vw, 20px);
  color: var(--muted);
  margin: 0;
}

.panel {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 24px 60px var(--shadow);
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  align-items: center;
  animation: fadeUp 0.9s ease-out both;
  animation-delay: 0.1s;
}

.result {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.value {
  font-size: clamp(44px, 8vw, 84px);
  font-weight: 800;
  color: var(--primary);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

button {
  font: inherit;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button:focus-visible {
  outline: 3px solid rgba(216, 88, 63, 0.3);
  outline-offset: 2px;
}

.primary {
  background: var(--primary);
  color: #fffaf2;
  box-shadow: 0 12px 24px rgba(216, 88, 63, 0.3);
}

.primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.ghost {
  background: transparent;
  border: 1px solid rgba(107, 98, 88, 0.3);
  color: var(--ink);
}

.ghost:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 18px rgba(29, 26, 22, 0.08);
}

.history {
  background: rgba(255, 250, 242, 0.8);
  border-radius: var(--radius-md);
  padding: 22px 26px;
  box-shadow: 0 18px 40px rgba(20, 16, 12, 0.08);
  animation: fadeUp 1s ease-out both;
  animation-delay: 0.2s;
}

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

.history h2 {
  margin: 0;
  font-size: 20px;
}

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

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.history-list li {
  background: #ffffff;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-weight: 700;
  font-size: 18px;
  text-align: center;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(29, 26, 22, 0.06);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .panel {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: row;
  }
}

@media (max-width: 520px) {
  body {
    padding: 28px 16px 40px;
  }

  .actions {
    flex-direction: column;
  }

  .history-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
