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

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at 50% 20%, #ffe8f0 0%, #ffc8d8 35%, #c898b8 100%);
  color: #2a2030;
  font-family: "Press Start 2P", monospace;
  -webkit-font-smoothing: none;
  font-smooth: never;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.25rem;
  min-height: 100vh;
  min-height: 100dvh;
}

.device {
  width: min(100%, 22rem);
  padding: 1rem 1rem 0.75rem;
  border-radius: 2.5rem 2.5rem 1.5rem 1.5rem;
  background: linear-gradient(165deg, #fff8fc 0%, #f0d8e8 45%, #d8a8c8 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.7),
    inset 0 -4px 12px rgba(120, 60, 90, 0.15),
    0 0 0 4px #603050,
    0 0 0 8px #f8e8f0,
    0 20px 50px rgba(80, 30, 60, 0.35);
}

.device-header,
.device-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.brand {
  font-size: 7px;
  color: #804060;
  letter-spacing: 0.05em;
}

.clock {
  font-size: 7px;
  color: #604050;
}

#screen-wrap {
  position: relative;
  margin: 0.75rem 0 0.5rem;
  padding: 10px;
  border-radius: 12px;
  background: #889898;
  box-shadow:
    inset 0 0 0 3px #384848,
    inset 0 4px 12px rgba(0, 0, 0, 0.25);
}

#screen {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #c8e8f8;
  border-radius: 4px;
}

.alert-icon {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f85050;
  color: #fff;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
  animation: blink 0.8s step-end infinite;
  box-shadow: 0 0 0 2px #fff;
}

.alert-icon.hidden {
  display: none;
}

@keyframes blink {
  50% { opacity: 0.2; }
}

.overlay {
  position: absolute;
  inset: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: rgba(16, 16, 32, 0.72);
  color: #f8f8ff;
  font-size: 8px;
  line-height: 1.8;
  text-align: center;
  padding: 0.75rem;
  white-space: pre-line;
}

.overlay.hidden {
  display: none;
}

.stats {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.stat {
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  align-items: center;
  gap: 0.4rem;
}

.stat-label {
  font-size: 6px;
  color: #604050;
}

.bar {
  height: 8px;
  border-radius: 4px;
  background: #f0e0e8;
  border: 2px solid #806070;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 100%;
  transition: width 0.25s ease;
}

.bar-fill.hunger { background: linear-gradient(90deg, #f8a030, #f8d060); }
.bar-fill.happy { background: linear-gradient(90deg, #f85888, #f898b8); }
.bar-fill.clean { background: linear-gradient(90deg, #58c8e8, #98e8f8); }
.bar-fill.health { background: linear-gradient(90deg, #58d868, #98f898); }

.message {
  min-height: 2.4rem;
  margin: 0.25rem 0 0.5rem;
  font-size: 7px;
  line-height: 1.7;
  text-align: center;
  color: #503040;
}

.info-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 6px;
  color: #705060;
}

.actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.action-btn,
.sub-btn,
.modal-btn {
  font-family: inherit;
  font-size: 6px;
  line-height: 1.5;
  padding: 0.55rem 0.2rem;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.08s ease;
}

.action-btn {
  background: linear-gradient(180deg, #fff8fc, #e8c8d8);
  color: #503040;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 2px 0 #906080;
}

.action-btn:active {
  transform: translateY(2px);
}

.action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.sub-btn {
  background: transparent;
  color: #806070;
  box-shadow: none;
  padding: 0.35rem 0.5rem;
}

.hint {
  max-width: 22rem;
  margin: 0;
  font-size: 6px;
  line-height: 1.8;
  text-align: center;
  color: rgba(48, 32, 48, 0.75);
}

.modal-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(32, 16, 32, 0.55);
  backdrop-filter: blur(4px);
}

.modal-screen.hidden {
  display: none;
}

.modal-card {
  width: min(100%, 20rem);
  padding: 1.25rem 1rem;
  border-radius: 1rem;
  background: linear-gradient(165deg, #fff8fc, #f0d0e0);
  box-shadow: 0 0 0 4px #603050, 0 16px 40px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.modal-title {
  margin: 0 0 0.5rem;
  font-size: 11px;
  font-weight: normal;
  color: #603050;
}

.modal-sub {
  margin: 0 0 1rem;
  font-size: 6px;
  line-height: 1.8;
  color: #806070;
}

.name-label {
  display: block;
  margin-bottom: 1rem;
  font-size: 6px;
  color: #604050;
}

.name-label input {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.6rem;
  border: 2px solid #906080;
  border-radius: 8px;
  font-family: inherit;
  font-size: 8px;
  text-align: center;
  background: #fff;
  color: #302030;
}

.modal-btn {
  background: linear-gradient(180deg, #fff8fc, #e8c8d8);
  color: #503040;
  box-shadow: 0 2px 0 #906080;
  padding: 0.65rem 1.2rem;
}

.modal-btn.primary {
  background: linear-gradient(180deg, #f8a8c8, #d87898);
  color: #fff;
  box-shadow: 0 2px 0 #804060;
}

.modal-note {
  margin: 0.75rem 0 0;
  font-size: 5px;
  line-height: 1.8;
  color: #907080;
}

.tutorial-text {
  min-height: 4rem;
  margin: 0 0 1rem;
  font-size: 7px;
  line-height: 1.9;
  color: #503040;
  white-space: pre-line;
}

.ending-card .modal-title {
  font-size: 9px;
}

.ending-badge {
  display: inline-block;
  margin: 0 0 0.5rem;
  padding: 0.25rem 0.5rem;
  font-size: 6px;
  border-radius: 4px;
  background: #f8d878;
  color: #604020;
}

.ending-body {
  margin: 0 0 0.75rem;
  font-size: 6px;
  line-height: 1.9;
  color: #503040;
  white-space: pre-line;
}

.ending-stats {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  font-size: 6px;
  line-height: 2;
  color: #705060;
  text-align: left;
}

@media (max-width: 360px) {
  .actions {
    grid-template-columns: repeat(2, 1fr);
  }
}
