:root {
  color-scheme: light;
  --pink: #ffd6e8;
  --warm-pink: #ff9fc5;
  --cream: #fff8ea;
  --milk: #fffdf9;
  --lavender: #d9c9ff;
  --peach: #ffd5ba;
  --ink: #46323d;
  --muted: #816d78;
  --line: rgba(141, 91, 115, 0.2);
  --shadow: 0 18px 42px rgba(169, 100, 137, 0.18);
  --small-shadow: 0 8px 22px rgba(169, 100, 137, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: linear-gradient(160deg, var(--cream) 0%, #ffeaf3 48%, #efe6ff 100%);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button,
summary,
.file-button {
  -webkit-tap-highlight-color: transparent;
}

.bubbles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.bubbles span {
  position: absolute;
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  box-shadow: inset 0 0 0 1px rgba(255, 159, 197, 0.22);
}

.bubbles span:nth-child(1) {
  top: 7%;
  left: -22px;
}

.bubbles span:nth-child(2) {
  top: 25%;
  right: -26px;
  width: 96px;
  height: 96px;
}

.bubbles span:nth-child(3) {
  bottom: 24%;
  left: 8%;
  width: 44px;
  height: 44px;
}

.bubbles span:nth-child(4) {
  bottom: 8%;
  right: 14%;
  width: 32px;
  height: 32px;
}

.app-shell {
  position: relative;
  width: min(100%, 520px);
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.hero {
  padding: 16px 0 12px;
}

.cat-panel,
.form-card,
.tools-card,
.game-card {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.78);
  background: rgba(255, 253, 249, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.cat-panel {
  border-radius: 30px;
  padding: 26px 22px 24px;
  overflow: visible;
}

.cat-panel::after,
.game-card::after {
  content: "*";
  position: absolute;
  top: 16px;
  right: 22px;
  color: var(--warm-pink);
  font-weight: 800;
  opacity: 0.72;
}

.ear {
  position: absolute;
  top: -12px;
  width: 34px;
  height: 34px;
  background: linear-gradient(145deg, var(--pink), var(--milk));
  border: 1px solid rgba(255, 255, 255, 0.8);
  transform: rotate(45deg);
}

.ear-left {
  left: 42px;
  border-radius: 8px 4px 10px 4px;
}

.ear-right {
  right: 42px;
  border-radius: 4px 8px 4px 10px;
}

.kicker {
  margin: 0 0 6px;
  color: #a45e83;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  max-width: 92%;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  font-size: clamp(2.25rem, 12vw, 3.45rem);
  font-weight: 900;
  line-height: 1.08;
}

h2 {
  margin-bottom: 0;
  font-size: 1.28rem;
}

.hero p:last-child,
.status-message,
.empty-state,
.game-description,
.game-meta {
  color: var(--muted);
}

.form-card,
.tools-card,
.shelf {
  margin-top: 16px;
}

.form-card,
.tools-card {
  border-radius: 26px;
  padding: 18px;
}

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

label {
  display: block;
  margin: 16px 0 7px;
  font-size: 0.9rem;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  outline: none;
  padding: 15px 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

input:focus,
textarea:focus {
  border-color: #ef7cac;
  box-shadow: 0 0 0 4px rgba(255, 159, 197, 0.24);
}

textarea {
  resize: vertical;
}

.html-paste {
  min-height: 220px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.5;
}

.form-actions,
.backup-actions,
.card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.form-actions {
  margin-top: 16px;
}

button,
.file-button {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  cursor: pointer;
  font-weight: 850;
  text-align: center;
}

.primary-button {
  flex: 1 1 150px;
  background: linear-gradient(135deg, #ff83b7, #ffbd96);
  color: #fff;
  box-shadow: var(--small-shadow);
}

.ghost-button,
.soft-button,
.file-button {
  background: #fff5fb;
  color: #7a4563;
  box-shadow: inset 0 0 0 1px rgba(255, 159, 197, 0.28);
}

.edit-badge,
.count-pill,
.tag-pill {
  border-radius: 999px;
  background: #f0e9ff;
  color: #6d548f;
  font-size: 0.78rem;
  font-weight: 850;
  padding: 8px 11px;
}

.status-message {
  min-height: 22px;
  margin: 14px 2px 0;
  font-size: 0.92rem;
}

.backup-panel {
  margin-top: 14px;
}

.backup-panel summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  color: #7a4563;
  font-weight: 850;
}

#importInput {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.shelf-heading {
  padding: 2px 2px 0;
}

.cards-list {
  display: grid;
  gap: 14px;
}

.game-card {
  border-radius: 24px;
  padding: 18px;
}

.game-card::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 18px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--peach);
  box-shadow: 14px 0 0 var(--pink), 28px 0 0 var(--lavender);
}

.game-card h3 {
  margin: 18px 28px 8px 0;
  font-size: 1.18rem;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.game-description {
  margin-bottom: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}

.game-meta {
  margin-bottom: 14px;
  font-size: 0.8rem;
}

.card-actions button {
  flex: 1 1 42%;
}

.run-button {
  background: linear-gradient(135deg, #c7b5ff, #ffabc9);
  color: #fff;
}

.delete-button {
  background: #fff0ef;
  color: #9b4646;
  box-shadow: inset 0 0 0 1px rgba(255, 142, 129, 0.3);
}

.empty-state {
  border: 1px dashed rgba(164, 94, 131, 0.28);
  border-radius: 24px;
  margin-top: 8px;
  padding: 28px 16px;
  text-align: center;
  background: rgba(255, 255, 255, 0.46);
}

.paw {
  position: relative;
  width: 54px;
  height: 48px;
  margin: 0 auto 8px;
}

.paw span {
  position: absolute;
  border-radius: 999px;
  background: #ffadc9;
}

.paw span:nth-child(1) {
  width: 26px;
  height: 22px;
  left: 14px;
  bottom: 3px;
}

.paw span:nth-child(2),
.paw span:nth-child(3),
.paw span:nth-child(4) {
  width: 13px;
  height: 15px;
  top: 4px;
}

.paw span:nth-child(2) {
  left: 7px;
}

.paw span:nth-child(3) {
  left: 22px;
  top: 0;
}

.paw span:nth-child(4) {
  right: 7px;
}

.footer {
  display: grid;
  gap: 5px;
  justify-items: center;
  padding: 24px 0 6px;
  color: rgba(70, 50, 61, 0.62);
  font-size: 0.82rem;
}

.footer small {
  max-width: 100%;
  color: rgba(70, 50, 61, 0.5);
  font-size: 0.66rem;
  text-align: center;
}

[hidden] {
  display: none !important;
}

@media (min-width: 700px) {
  body {
    display: flex;
    justify-content: center;
  }

  .app-shell {
    padding-top: 28px;
  }
}
