@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@500;700;800&family=Press+Start+2P&display=swap");

:root {
  --color-bg: #f0eee6;
  --color-brown: #8b5a3c;
  --color-text: #2f241d;
  --color-card: #fff8ec;
  --color-muted: #a58a72;
  --color-moss: #5b8c5a;
  --color-stone: #2c3034;
  --radius: 18px;
  --shadow: 0 10px 28px rgba(47, 36, 29, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--color-text);
  background:
    radial-gradient(ellipse at 20% 0%, rgba(224, 168, 74, 0.18), transparent 45%),
    radial-gradient(ellipse at 90% 20%, rgba(91, 140, 90, 0.12), transparent 40%),
    linear-gradient(180deg, #e8e2d4 0%, var(--color-bg) 40%, #e4ddd0 100%);
}

.app {
  width: min(440px, 100% - 2rem);
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.screen {
  display: none;
  animation: fade-in 0.35s ease;
}

.screen.active {
  display: block;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.eyebrow {
  margin: 0 0 0.4rem;
  font-family: "Press Start 2P", monospace;
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  color: var(--color-brown);
  text-align: center;
}

.title {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(1.1rem, 4vw, 1.35rem);
  line-height: 1.5;
  text-align: center;
  color: var(--color-stone);
}

.tagline,
.time-guide,
.hint,
.screen-title {
  text-align: center;
}

.tagline {
  margin: 0.85rem 0 1.25rem;
  color: var(--color-muted);
  font-size: 1rem;
}

.screen-title {
  margin: 0 0 0.75rem;
  font-size: 1.35rem;
  color: var(--color-stone);
}

.time-guide {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 248, 236, 0.85);
  border: 2px solid rgba(139, 90, 60, 0.2);
  border-radius: var(--radius);
  font-weight: 700;
  color: var(--color-brown);
}

.pixel-image {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

.grug-hero {
  margin: 0 auto 1.25rem;
  width: min(220px, 70vw);
  height: auto;
  filter: drop-shadow(0 8px 16px rgba(47, 36, 29, 0.15));
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.btn {
  appearance: none;
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 0.85rem 1.2rem;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:focus-visible {
  outline: 3px solid rgba(224, 168, 74, 0.7);
  outline-offset: 2px;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--color-brown);
  color: #fff8ec;
}

.btn-primary:hover {
  background: #734a31;
}

.btn-ghost {
  background: transparent;
  border-color: rgba(139, 90, 60, 0.35);
  color: var(--color-brown);
}

.btn-ghost:hover {
  background: rgba(255, 248, 236, 0.7);
}

.btn-danger {
  background: transparent;
  border-color: rgba(139, 90, 60, 0.35);
  color: #8a3b2a;
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  border-radius: 999px;
}

.emotion-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}

.emotion-btn {
  appearance: none;
  border: 2px solid rgba(139, 90, 60, 0.25);
  background: var(--color-card);
  color: var(--color-text);
  border-radius: 14px;
  padding: 0.75rem 0.5rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.emotion-btn:hover {
  border-color: var(--color-brown);
}

.emotion-btn:focus-visible {
  outline: 3px solid rgba(224, 168, 74, 0.7);
  outline-offset: 2px;
}

.emotion-btn.selected {
  background: rgba(139, 90, 60, 0.12);
  border-color: var(--color-brown);
  box-shadow: inset 0 0 0 1px var(--color-brown);
}

.field-label {
  display: block;
  margin: 0.5rem 0 0.35rem;
  font-weight: 700;
  color: var(--color-brown);
}

.user-message {
  width: 100%;
  resize: vertical;
  min-height: 4.5rem;
  padding: 0.85rem 1rem;
  border: 2px solid rgba(139, 90, 60, 0.25);
  border-radius: var(--radius);
  background: var(--color-card);
  color: var(--color-text);
  font: inherit;
}

.user-message:focus {
  outline: 3px solid rgba(224, 168, 74, 0.55);
  border-color: var(--color-brown);
}

.hint {
  margin: 0.5rem 0;
  color: var(--color-muted);
  font-size: 0.95rem;
}

.hint[hidden] {
  display: none;
}

.breath-label {
  margin: 2rem 0 0.5rem;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--color-brown);
}

.breath-count {
  margin: 0;
  text-align: center;
  font-family: "Press Start 2P", monospace;
  font-size: 2.4rem;
  color: var(--color-stone);
}

.pixel-card {
  background: var(--color-card);
  border: 3px solid rgba(139, 90, 60, 0.28);
  border-radius: 22px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.card-grug {
  margin: 0 auto 0.75rem;
}

.card-meta {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.card-emotion {
  margin: 0.5rem 0;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--color-brown);
}

.card-user {
  margin: 0.35rem 0;
  color: var(--color-text);
}

.card-grug-msg {
  margin: 0.85rem 0 0;
  padding-top: 0.85rem;
  border-top: 2px dashed rgba(139, 90, 60, 0.25);
  font-weight: 700;
  color: var(--color-stone);
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.history-card {
  background: var(--color-card);
  border: 2px solid rgba(139, 90, 60, 0.22);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.history-card-top {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.history-card-top img {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.history-card h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  color: var(--color-brown);
}

.history-card p {
  margin: 0.2rem 0;
  font-size: 0.95rem;
}

.history-actions {
  margin-top: 0.75rem;
  display: flex;
  justify-content: flex-end;
}

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  background: rgba(255, 248, 236, 0.7);
  border-radius: var(--radius);
  border: 2px dashed rgba(139, 90, 60, 0.25);
  color: var(--color-muted);
}

@media (max-width: 380px) {
  .emotion-list {
    grid-template-columns: 1fr;
  }
}
