:root {
  --bg: #fff7ed;
  --panel: #fffefa;
  --ink: #2b2230;
  --muted: #766577;
  --line: #f7c6d9;
  --pink: #ff7ab6;
  --pink-dark: #e1488e;
  --mint: #72e6b1;
  --sun: #ffd166;
  --sky: #88d8ff;
  --violet: #8b5cf6;
  --danger: #d6336c;
  --shadow: 0 18px 40px rgba(214, 51, 108, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 209, 102, 0.42), transparent 28%),
    radial-gradient(circle at 88% 5%, rgba(136, 216, 255, 0.36), transparent 26%),
    linear-gradient(160deg, #fff7ed 0%, #fff0f7 48%, #eefcf5 100%);
  color: var(--ink);
  font-family: ui-rounded, "Aptos Rounded", "Segoe UI", system-ui, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("assets/tulips-bg.png");
  background-position: 24px 34px;
  background-repeat: repeat;
  background-size: 360px auto;
  opacity: .18;
}

.flower-field {
  position: fixed;
  top: clamp(8px, 3vw, 30px);
  right: clamp(12px, 5vw, 70px);
  z-index: 0;
  width: min(430px, 62vw);
  height: auto;
  pointer-events: none;
  opacity: .48;
}

button,
input,
select {
  font: inherit;
}

button,
input,
select {
  border: 2px solid var(--line);
  border-radius: 18px;
}

button {
  max-width: 100%;
  min-width: 0;
  min-height: 46px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  padding: 0 16px;
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select {
  width: 100%;
  min-height: 48px;
  background: white;
  color: var(--ink);
  padding: 0 14px;
}

button:focus-visible,
input:focus,
select:focus {
  outline: 4px solid rgba(255, 122, 182, 0.24);
  outline-offset: 2px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(44px, 13vw, 76px);
  line-height: 0.9;
}

h2 {
  font-size: 24px;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 980px);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(22px, env(safe-area-inset-bottom));
}

.hero {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.hero-flowers {
  position: absolute;
  top: -4px;
  right: 90px;
  z-index: 0;
  width: min(340px, 42vw);
  height: auto;
  opacity: .9;
  pointer-events: none;
}

.hero > div,
.horse {
  position: relative;
  z-index: 1;
}

.horse {
  flex: 0 0 132px;
  width: 132px;
  height: auto;
  filter: drop-shadow(0 9px 12px rgba(90, 58, 45, 0.16));
}

.eyebrow {
  color: var(--pink-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.soft,
.tiny {
  color: var(--muted);
}

.tiny {
  font-size: 13px;
  font-weight: 700;
}

.panel,
.stamp-card {
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(247, 198, 217, 0.8);
  border-radius: 24px;
  background: rgba(255, 254, 250, 0.92);
  box-shadow: var(--shadow);
}

.panel > *,
.stamp-card > * {
  position: relative;
  z-index: 1;
}

.auth-panel,
.editor-panel,
.overview-panel {
  padding: 18px;
}

.install-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  margin-bottom: 14px;
}

.install-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.install-actions button {
  min-height: 40px;
}

.auth-panel {
  display: grid;
  gap: 14px;
}

.email-login,
.two-cols,
.form-actions,
.export-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.list-heading {
  margin: 16px 0 10px;
}

.wide,
.primary {
  border-color: var(--pink);
  background: var(--pink);
  color: white;
}

.primary:hover {
  background: var(--pink-dark);
}

.quiet {
  border-color: rgba(247, 198, 217, 0.65);
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
}

.danger {
  color: var(--danger);
}

#mainView {
  display: grid;
  gap: 16px;
}

.stamp-card {
  display: grid;
  gap: 18px;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(255, 122, 182, 0.15), rgba(114, 230, 177, 0.14)),
    rgba(255, 254, 250, 0.94);
}

.stamp-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.stamp {
  width: 100%;
  min-width: 0;
  min-height: 86px;
  border-radius: 28px;
  color: white;
  font-size: clamp(18px, 2.6vw, 28px);
  box-shadow: 0 14px 26px rgba(43, 34, 48, 0.14);
  white-space: nowrap;
}

.stamp.in {
  border-color: #34d399;
  background: linear-gradient(135deg, #10b981, #72e6b1);
}

.stamp.out {
  border-color: #fb7185;
  background: linear-gradient(135deg, #fb7185, #ff7ab6);
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.entry-form,
.entries-list {
  display: grid;
  gap: 12px;
}

.form-message {
  min-height: 18px;
}

.stamp-message {
  min-height: 18px;
  margin: 8px 0 0;
}

.stamp-message[data-tone="success"] {
  color: #12805c;
}

.stamp-message[data-tone="error"] {
  color: var(--danger);
}

.form-message[data-tone="success"] {
  color: #12805c;
}

.form-message[data-tone="error"] {
  color: var(--danger);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.summary > div,
.entry-item {
  border: 2px solid rgba(247, 198, 217, 0.8);
  border-radius: 20px;
  background: white;
}

.summary > div {
  min-height: 86px;
  padding: 14px;
}

.summary span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.summary strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.target-setting {
  max-width: 180px;
  margin-bottom: 14px;
}

.entry-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  min-height: 76px;
  text-align: left;
  transition: border-color .16s ease, transform .16s ease;
}

.entry-item:hover {
  border-color: var(--pink);
}

.entry-main strong,
.entry-main span {
  display: block;
}

.entry-main span {
  color: var(--muted);
  font-weight: 700;
  margin-top: 3px;
}

.entry-meta {
  color: var(--pink-dark);
  font-weight: 900;
  text-align: right;
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}

.user-info {
  margin-right: auto;
  font-weight: 900;
}

[hidden] {
  display: none !important;
}

@media (min-width: 760px) {
  #mainView {
    grid-template-columns: 1fr 1fr;
  }

  .stamp-card,
  .overview-panel {
    grid-column: span 2;
  }

  .stamp-card {
    grid-template-columns: minmax(0, 0.85fr) minmax(430px, 1.15fr);
    align-items: center;
  }
}

@media (max-width: 520px) {
  .hero {
    min-height: 116px;
  }

  .hero-flowers {
    top: 4px;
    right: 54px;
    width: 210px;
    opacity: .92;
  }

  .horse {
    flex-basis: 86px;
    width: 86px;
  }

  body::before {
    background-size: 300px auto;
    opacity: .14;
  }

  .flower-field {
    top: 10px;
    right: -64px;
    width: 300px;
    opacity: .42;
  }

  .stamp-actions,
  .email-login,
  .two-cols,
  .form-actions,
  .export-actions,
  .summary {
    grid-template-columns: 1fr;
  }

  .section-title,
  .install-panel,
  footer {
    align-items: stretch;
    flex-direction: column;
  }

  .install-actions {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .form-actions button,
  .export-actions button {
    width: 100%;
  }
}
