:root {
  color-scheme: light;
  --bg: #fff8fc;
  --bg-2: #f5f7ff;
  --surface: #ffffff;
  --surface-soft: #fff2f8;
  --text: #2b2630;
  --muted: #6f6574;
  --line: rgba(86, 62, 96, 0.18);
  --shadow: 0 14px 36px rgba(85, 61, 92, 0.11);
  --pink: #e75f9e;
  --lavender: #8177e8;
  --blue: #2e9fc1;
  --green: #22a06b;
  --orange: #ec8a35;
  --pink-strong: #bd2f72;
  --lavender-strong: #5d50c7;
  --blue-strong: #197793;
  --green-strong: #087347;
  --orange-strong: #a94f08;
  --danger: #c65a65;
  --radius: 18px;
  --radius-small: 12px;
  --radius-large: 24px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(255, 236, 247, 0.92), rgba(246, 248, 255, 0.96) 44%, rgba(255, 255, 255, 0.96)),
    var(--bg);
}

body[data-season="spring"] {
  background:
    linear-gradient(135deg, rgba(255, 237, 247, 0.94), rgba(248, 244, 255, 0.96) 44%, rgba(255, 255, 255, 0.96)),
    var(--bg);
}

body[data-season="summer"] {
  background:
    linear-gradient(135deg, rgba(255, 244, 249, 0.92), rgba(237, 250, 255, 0.94) 46%, rgba(255, 255, 255, 0.96)),
    var(--bg);
}

body[data-season="autumn"] {
  background:
    linear-gradient(135deg, rgba(255, 241, 247, 0.94), rgba(249, 244, 255, 0.96) 45%, rgba(255, 252, 247, 0.96)),
    var(--bg);
}

body[data-season="winter"] {
  background:
    linear-gradient(135deg, rgba(250, 247, 255, 0.96), rgba(238, 249, 255, 0.94) 44%, rgba(255, 255, 255, 0.98)),
    var(--bg);
}

button,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
}

img {
  max-width: 100%;
}

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

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  border-radius: var(--radius-small);
  padding: 10px 14px;
  color: #ffffff;
  background: var(--text);
  font-weight: 900;
  text-decoration: none;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.page-shell {
  width: min(1160px, calc(100% - 20px));
  margin: 0 auto;
  padding: 18px 0 calc(42px + var(--safe-bottom));
}

.site-header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.site-heading {
  min-width: 0;
}

.header-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 28px rgba(85, 61, 92, 0.08);
  font-size: 0.78rem;
  font-weight: 800;
}

.header-progress span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.header-progress span:first-child > span {
  color: #e5a437;
  font-size: 1.2rem;
}

.header-progress span:nth-child(2) > span {
  color: var(--pink-strong);
  font-size: 1.08rem;
}

.header-progress strong {
  color: var(--text);
  font-size: 1rem;
}

.header-progress.has-boost {
  border-color: rgba(231, 95, 158, 0.42);
  background: rgba(255, 244, 250, 0.94);
}

.header-progress.has-boost span:last-child strong {
  color: var(--pink-strong);
}

.back-link {
  width: fit-content;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.82);
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
}

.back-link::before {
  content: "<";
  margin-right: 7px;
  color: var(--pink);
}

.back-link:focus-visible,
button:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--lavender-strong);
  outline-offset: 3px;
}

.data-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  border: 2px solid rgba(198, 90, 101, 0.42);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: #6f2630;
  background: #fff1f2;
  box-shadow: var(--shadow);
}

.data-banner[hidden] {
  display: none;
}

.data-banner p {
  margin: 4px 0 0;
  font-size: 0.82rem;
  line-height: 1.55;
}

body.is-protected .game-layout,
body.is-protected .log-row {
  opacity: 0.72;
}

body.is-protected .scene-frame {
  cursor: default;
}

h1 {
  margin-bottom: 8px;
  font-size: 2rem;
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.08rem;
  line-height: 1.3;
  letter-spacing: 0;
}

.lead {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.75;
}

.game-layout {
  display: grid;
  gap: 14px;
  align-items: start;
}

.hero-card,
.panel-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.hero-card {
  overflow: hidden;
  padding: 12px;
}

.scene-frame {
  position: relative;
  display: grid;
  place-items: center;
  min-height: min(48vh, 430px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 235, 247, 0.84)),
    var(--surface-soft);
  cursor: pointer;
}

.scene-frame:focus-visible {
  outline: 3px solid rgba(129, 119, 232, 0.34);
  outline-offset: 3px;
}

.scene-frame[data-category="food"] {
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.96), rgba(255, 236, 224, 0.86)),
    #fff8f2;
}

.scene-frame[data-category="creative"] {
  background:
    linear-gradient(180deg, rgba(249, 250, 255, 0.96), rgba(231, 246, 255, 0.86)),
    #f3fbff;
}

.scene-frame[data-category="travel"] {
  background:
    linear-gradient(180deg, rgba(248, 255, 252, 0.96), rgba(229, 245, 255, 0.88)),
    #f3fbff;
}

.scene-frame[data-category="rare"] {
  background:
    linear-gradient(180deg, rgba(255, 252, 235, 0.98), rgba(255, 236, 248, 0.9)),
    #fffaf0;
}

.scene-image {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 620px;
  max-height: min(58vh, 520px);
  object-fit: contain;
  padding: 8px;
  transform-origin: 50% 86%;
  animation: idleFloat 4.8s ease-in-out infinite;
}

.scene-reaction {
  position: absolute;
  z-index: 2;
  top: 22%;
  left: 5%;
  width: min(36%, 170px);
  border: 1px solid rgba(86, 62, 96, 0.16);
  border-radius: 50% 50% 50% 42%;
  padding: 13px 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 24px rgba(85, 61, 92, 0.11);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.55;
  text-align: center;
  transform: rotate(-2deg);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.scene-reaction::after {
  content: "";
  position: absolute;
  right: 7%;
  bottom: -10px;
  width: 18px;
  height: 18px;
  border-right: 1px solid rgba(86, 62, 96, 0.16);
  border-bottom: 1px solid rgba(86, 62, 96, 0.16);
  background: inherit;
  transform: rotate(38deg) skew(8deg);
}

.scene-reaction.is-speaking {
  border-color: rgba(231, 95, 158, 0.38);
  background: rgba(255, 248, 252, 0.98);
  transform: rotate(-1deg) scale(1.025);
}

.scene-frame.is-talking .scene-image {
  animation: talkBounce 0.52s ease both;
}

.scene-frame[data-rarity="SR"] {
  border-color: rgba(129, 119, 232, 0.48);
  box-shadow: inset 0 0 0 2px rgba(129, 119, 232, 0.08);
}

.scene-frame[data-rarity="SSR"] {
  border-color: rgba(229, 164, 55, 0.68);
  box-shadow: inset 0 0 0 2px rgba(229, 164, 55, 0.14), 0 14px 34px rgba(229, 164, 55, 0.16);
}

.badge.rarity {
  text-transform: uppercase;
}

.scene-frame[data-rarity="SR"] .badge.rarity {
  background: linear-gradient(135deg, var(--lavender), var(--pink));
}

.scene-frame[data-rarity="SSR"] .badge.rarity {
  color: #4c3522;
  background: linear-gradient(135deg, #f7d778, #f0a1c5);
}

.gacha-burst {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
}

.gacha-burst::before {
  content: "";
  position: absolute;
  width: min(56%, 320px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.98) 0 16%, rgba(246, 128, 194, 0.36) 17% 42%, rgba(129, 119, 232, 0.16) 43% 62%, transparent 63%),
    conic-gradient(from 24deg, rgba(255, 255, 255, 0.92), rgba(246, 128, 194, 0.36), rgba(129, 119, 232, 0.34), rgba(255, 255, 255, 0.92));
  filter: blur(0.2px);
}

.gacha-burst span {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 999px;
  padding: 8px 14px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--pink), var(--lavender));
  box-shadow: 0 14px 30px rgba(129, 119, 232, 0.26);
  font-size: 0.9rem;
  font-weight: 900;
}

.scene-frame.is-gacha-rolling .gacha-burst {
  animation: gachaBurst 0.72s ease both;
}

.scene-frame.is-gacha-rolling .scene-image {
  animation: gachaRoll 0.72s ease both;
}

.scene-frame[data-category="daily"] .scene-image,
.scene-frame[data-category="night"] .scene-image {
  max-width: 360px;
}

.scene-badges {
  position: absolute;
  z-index: 2;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: var(--radius);
  padding: 4px 9px;
  color: #ffffff;
  background: rgba(43, 38, 48, 0.72);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: lowercase;
}

.badge.rarity {
  background: linear-gradient(135deg, var(--pink), var(--lavender));
}

.scene-copy {
  padding: 14px 2px 2px;
}

.scene-copy h2 {
  margin-bottom: 8px;
  font-size: 1.45rem;
}

.scene-copy p,
.daily-card p,
.share-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.scene-copy .affinity-hint {
  margin-top: 7px;
  color: #8b4e75;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.45;
}

.offline-summary {
  margin-top: 12px;
  border: 1px solid rgba(34, 160, 107, 0.28);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(239, 251, 246, 0.96);
}

.offline-summary[hidden] {
  display: none;
}

.offline-summary .panel-title-row {
  margin-bottom: 8px;
}

.offline-summary > p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.offline-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.offline-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  min-width: 0;
  border-radius: var(--radius-small);
  padding: 8px 9px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.86);
  font-size: 0.76rem;
  font-weight: 800;
}

.offline-result-item strong {
  color: var(--green-strong);
  font-size: 0.86rem;
}

.primary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.action-button,
.share-button,
.ghost-button {
  min-height: 46px;
  border-radius: var(--radius);
  font-weight: 900;
  letter-spacing: 0;
  transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease;
}

.action-button {
  display: grid;
  place-items: center;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
  padding: 7px 8px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--pink-strong), var(--lavender-strong));
  box-shadow: 0 10px 22px rgba(231, 95, 158, 0.24);
  line-height: 1.15;
}

.action-button:nth-child(2) {
  background: linear-gradient(135deg, var(--orange-strong), var(--pink-strong));
}

.action-button:nth-child(3) {
  background: linear-gradient(135deg, var(--lavender-strong), var(--blue-strong));
}

.action-button:nth-child(4) {
  background: linear-gradient(135deg, var(--green-strong), var(--blue-strong));
}

.action-button span {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 0.95rem;
}

.action-button-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.action-button-main span,
.action-button small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.action-button-main svg {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
}

.action-button small {
  max-width: 100%;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1.1;
}

.action-button[data-ticket-state="empty"] {
  opacity: 0.72;
  box-shadow: none;
}

.action-button.is-quest-target:not(:disabled) {
  outline: 3px solid rgba(231, 95, 158, 0.2);
  outline-offset: 2px;
  box-shadow: 0 10px 26px rgba(231, 95, 158, 0.3);
}

.action-button:disabled {
  filter: saturate(0.7);
}

.action-button:hover,
.share-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
  filter: saturate(1.04);
}

.action-button:disabled:hover {
  transform: none;
  filter: saturate(0.7);
}

.action-button:active,
.share-button:active,
.ghost-button:active {
  transform: translateY(0) scale(0.99);
}

.side-panel,
.log-row {
  display: grid;
  gap: 12px;
}

.panel-card {
  padding: 14px;
}

.eyebrow {
  margin-bottom: 3px;
  color: var(--pink-strong);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.onboarding-card {
  border-color: rgba(129, 119, 232, 0.28);
  background: rgba(248, 246, 255, 0.94);
}

.onboarding-card[hidden] {
  display: none;
}

.onboarding-card > p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.quest-card {
  overflow: hidden;
  border-color: rgba(231, 95, 158, 0.23);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(255, 247, 251, 0.94)),
    var(--surface);
}

.quest-title-row {
  align-items: flex-start;
}

.quest-title-row p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.quest-progress {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.84);
  font-size: 0.78rem;
  font-weight: 900;
}

.quest-progress.is-complete {
  border-color: rgba(34, 160, 107, 0.32);
  color: var(--green);
  background: rgba(235, 250, 244, 0.94);
}

.quest-guidance {
  margin: -2px 0 18px;
  color: #764461;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.45;
}

.quest-steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.quest-steps::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 48%;
  left: 17%;
  right: 17%;
  border-top: 3px dotted rgba(86, 62, 96, 0.22);
}

.quest-step {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  gap: 3px;
  min-width: 0;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  padding: 16px 6px 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 18px rgba(85, 61, 92, 0.06);
}

.quest-step.is-current {
  border-color: rgba(231, 95, 158, 0.7);
  color: var(--pink-strong);
  background: rgba(255, 248, 252, 0.98);
  box-shadow: 0 8px 24px rgba(231, 95, 158, 0.18);
  animation: questPulse 2s ease-in-out infinite;
}

.quest-step.is-complete {
  border-color: rgba(34, 160, 107, 0.34);
  color: var(--green-strong);
  background: rgba(241, 252, 247, 0.98);
}

.quest-step-number {
  position: absolute;
  top: -13px;
  left: 50%;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface);
  font-size: 0.74rem;
  font-weight: 900;
  transform: translateX(-50%);
}

.quest-step.is-current .quest-step-number {
  border-color: var(--pink-strong);
  color: #ffffff;
  background: var(--pink-strong);
}

.quest-step.is-complete .quest-step-number {
  border-color: var(--green-strong);
  color: #ffffff;
  background: var(--green-strong);
}

.quest-step-number svg {
  width: 15px;
  height: 15px;
}

.quest-step-icon svg,
.status-icon svg,
.action-button-main svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quest-step strong {
  max-width: 100%;
  color: currentColor;
  font-size: 0.78rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.quest-reward {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 12px 0 0;
  border: 1px solid rgba(231, 95, 158, 0.18);
  border-radius: var(--radius-small);
  padding: 8px 10px;
  color: #8b4e75;
  background: rgba(255, 240, 248, 0.7);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
}

.quest-reward span {
  color: #e5a437;
}

.quest-reward.is-complete {
  border-color: rgba(34, 160, 107, 0.24);
  color: #277858;
  background: rgba(237, 250, 244, 0.9);
}

.status-title-row {
  align-items: baseline;
}

.status-bonus {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-align: right;
}

.status-bonus::before {
  content: "✦";
  margin-right: 5px;
  color: #e5a437;
}

.status-bonus.is-active {
  color: var(--pink-strong);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.status-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  padding: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.status-item-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin-bottom: 7px;
}

.status-item-head > span:nth-child(2) {
  min-width: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.status-item-head strong {
  color: var(--text);
  font-size: 1rem;
}

.status-icon {
  display: inline-flex;
  color: var(--pink);
}

.status-icon svg {
  width: 17px;
  height: 17px;
}

.status-item[data-stat="hunger"] .status-icon {
  color: var(--orange);
}

.status-item[data-stat="creativity"] .status-icon {
  color: var(--lavender);
}

.status-item[data-stat="mood"] .status-icon {
  color: var(--green);
}

.status-meter {
  overflow: hidden;
  height: 7px;
  border-radius: 999px;
  background: rgba(43, 38, 48, 0.08);
}

.status-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 0.32s ease;
}

.status-recommendation {
  margin: 9px 0 0;
  border-radius: var(--radius-small);
  padding: 7px 9px;
  color: var(--muted);
  background: rgba(246, 244, 252, 0.84);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.4;
  text-align: center;
}

.status-recommendation::before {
  content: "✦";
  margin-right: 6px;
  color: #e5a437;
}

.status-scene-hint {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
  text-align: center;
}

.focus-card {
  border-color: rgba(129, 119, 232, 0.24);
  background: rgba(248, 247, 255, 0.94);
}

.focus-card > p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.focus-count {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

.focus-timer {
  display: grid;
  place-items: center;
  min-height: 58px;
  border: 1px solid rgba(129, 119, 232, 0.24);
  border-radius: var(--radius);
  color: var(--lavender-strong);
  background: rgba(255, 255, 255, 0.86);
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.focus-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 9px;
}

.focus-actions #focusCancel {
  grid-column: 1 / -1;
}

.focus-button {
  min-height: 44px;
  border-radius: var(--radius);
  color: #ffffff;
  background: var(--lavender-strong);
  font-weight: 900;
}

.focus-button:disabled {
  opacity: 0.55;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.record-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.record-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px;
  background: rgba(255, 255, 255, 0.72);
}

.record-item[data-action="total"] {
  grid-column: 1 / -1;
  background: rgba(255, 244, 251, 0.96);
  border-color: rgba(231, 95, 158, 0.26);
}

.record-label {
  min-width: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.record-item strong {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.1;
}

.ticket-card h2 {
  user-select: none;
}

.ticket-progress {
  margin-bottom: 6px;
}

.ticket-progress span {
  background: linear-gradient(90deg, var(--orange), var(--pink), var(--lavender));
}

.ticket-rate {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.ticket-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ticket-item {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px;
  background: rgba(255, 255, 255, 0.72);
}

.ticket-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.ticket-head span,
.ticket-head strong {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.15;
}

.ticket-head span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.ticket-head strong {
  color: var(--text);
  font-size: 0.82rem;
}

.ticket-meter {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: rgba(43, 38, 48, 0.08);
}

.ticket-meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pink), var(--lavender));
  transition: width 0.32s ease;
}

.ticket-item[data-action="eat"] .ticket-meter span {
  background: linear-gradient(90deg, var(--orange), var(--pink));
}

.ticket-item[data-action="create"] .ticket-meter span {
  background: linear-gradient(90deg, var(--lavender), var(--blue));
}

.ticket-item[data-action="travel"] .ticket-meter span {
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.progress-track {
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: rgba(43, 38, 48, 0.08);
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pink), var(--lavender));
  transition: width 0.32s ease;
}

.ghost-button {
  min-height: 36px;
  border: 1px solid var(--line);
  padding: 6px 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.84);
}

.ghost-button.wide {
  width: 100%;
  margin-top: 12px;
}

.daily-date,
.collection-count,
.muted {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.seasonal-text {
  margin-top: 8px;
  color: #8b4e75;
  font-size: 0.82rem;
  line-height: 1.65;
}

.command-progress-list {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.command-progress-row {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.command-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1.2;
}

.command-progress-head span,
.command-progress-head strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.mini-track {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: rgba(43, 38, 48, 0.08);
}

.mini-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pink), var(--lavender));
  transition: width 0.32s ease;
}

.command-progress-row[data-action="eat"] .mini-track span {
  background: linear-gradient(90deg, var(--orange), var(--pink));
}

.command-progress-row[data-action="create"] .mini-track span {
  background: linear-gradient(90deg, var(--lavender), var(--blue));
}

.command-progress-row[data-action="travel"] .mini-track span {
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.collection-note {
  margin: 10px 0 0;
  border: 1px solid rgba(231, 95, 158, 0.2);
  border-radius: var(--radius);
  padding: 9px 10px;
  color: #7e4a6c;
  background: rgba(255, 244, 251, 0.86);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.55;
}

.collection-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.collection-tools label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.2;
}

.collection-tools select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 28px 7px 9px;
  color: var(--text);
  background:
    linear-gradient(45deg, transparent 50%, var(--pink) 50%),
    linear-gradient(135deg, var(--pink) 50%, transparent 50%),
    rgba(255, 255, 255, 0.86);
  background-position:
    calc(100% - 15px) 16px,
    calc(100% - 10px) 16px,
    0 0;
  background-size:
    5px 5px,
    5px 5px,
    100% 100%;
  background-repeat: no-repeat;
  font-size: 0.84rem;
  font-weight: 900;
  appearance: none;
}

.collection-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.collection-stats div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  min-height: 42px;
  border: 1px solid rgba(231, 95, 158, 0.2);
  border-radius: var(--radius);
  padding: 8px 9px;
  background: rgba(255, 244, 251, 0.92);
}

.collection-stats span,
.collection-stats strong {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.15;
}

.collection-stats span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.collection-stats strong {
  color: var(--text);
  font-size: 0.9rem;
}

.collection-empty {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

#collectionLoadMore {
  margin-top: 12px;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.collection-item {
  position: relative;
  overflow: hidden;
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
}

.collection-item:not(.locked) {
  cursor: zoom-in;
}

.collection-item:not(.locked):hover {
  border-color: rgba(231, 95, 158, 0.42);
  box-shadow: 0 10px 22px rgba(231, 95, 158, 0.14);
}

.collection-item:not(.locked):focus-visible {
  outline: 3px solid rgba(129, 119, 232, 0.34);
  outline-offset: 3px;
}

.collection-item.unlockable {
  cursor: pointer;
  border-color: rgba(129, 119, 232, 0.44);
  color: #5b4fb8;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(245, 240, 255, 0.92)),
    repeating-linear-gradient(
      135deg,
      rgba(129, 119, 232, 0.09),
      rgba(129, 119, 232, 0.09) 8px,
      rgba(255, 255, 255, 0.72) 8px,
      rgba(255, 255, 255, 0.72) 16px
    );
  box-shadow: 0 10px 22px rgba(129, 119, 232, 0.13);
}

.collection-item.unlockable:hover {
  border-color: rgba(231, 95, 158, 0.48);
  box-shadow: 0 12px 26px rgba(231, 95, 158, 0.18);
}

.collection-item.unlockable:focus-visible {
  outline: 3px solid rgba(129, 119, 232, 0.34);
  outline-offset: 3px;
}

.collection-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.collection-item.locked {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  color: rgba(43, 38, 48, 0.36);
  font-size: 1.45rem;
  font-weight: 900;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(43, 38, 48, 0.05),
      rgba(43, 38, 48, 0.05) 8px,
      rgba(255, 255, 255, 0.62) 8px,
      rgba(255, 255, 255, 0.62) 16px
    );
}

.collection-item.locked.unlockable {
  color: #5b4fb8;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(245, 240, 255, 0.92)),
    repeating-linear-gradient(
      135deg,
      rgba(129, 119, 232, 0.09),
      rgba(129, 119, 232, 0.09) 8px,
      rgba(255, 255, 255, 0.72) 8px,
      rgba(255, 255, 255, 0.72) 16px
    );
}

.collection-unlock-cost {
  display: block;
  color: rgba(43, 38, 48, 0.56);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1.2;
}

.collection-item.unlockable .collection-unlock-cost {
  color: var(--lavender-strong);
}

.collection-label {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 4px 6px;
  color: #ffffff;
  background: rgba(43, 38, 48, 0.68);
  font-size: 0.68rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.is-viewer-open {
  overflow: hidden;
}

.collection-viewer[hidden] {
  display: none;
}

.collection-viewer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
}

.collection-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(43, 38, 48, 0.58);
}

.collection-viewer-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  width: min(920px, 100%);
  max-height: min(92vh, 860px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: var(--radius);
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 242, 248, 0.96)),
    var(--surface);
  box-shadow: 0 24px 68px rgba(43, 38, 48, 0.28);
}

.collection-viewer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.collection-viewer-close {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.9);
  font-size: 0.82rem;
  font-weight: 900;
}

.collection-viewer-nav {
  min-height: 36px;
  border: 1px solid rgba(231, 95, 158, 0.22);
  border-radius: var(--radius);
  padding: 6px 10px;
  color: var(--text);
  background: rgba(255, 244, 251, 0.92);
  font-size: 0.82rem;
  font-weight: 900;
}

.collection-viewer-nav:disabled {
  color: rgba(43, 38, 48, 0.32);
  background: rgba(255, 255, 255, 0.64);
}

.collection-viewer-image {
  display: block;
  width: 100%;
  max-height: 64vh;
  border-radius: var(--radius);
  object-fit: contain;
  background: rgba(255, 255, 255, 0.78);
}

.collection-viewer-copy {
  display: grid;
  gap: 6px;
}

.collection-viewer-meta {
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 3px 9px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--pink), var(--lavender));
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1.45;
}

.collection-viewer-copy h2 {
  font-size: 1.35rem;
}

.collection-viewer-copy p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.achievement-list {
  display: grid;
  gap: 8px;
}

.journal-empty {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.journal-empty[hidden] {
  display: none;
}

.journal-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.journal-entry {
  border-left: 3px solid rgba(231, 95, 158, 0.42);
  border-radius: 0 var(--radius-small) var(--radius-small) 0;
  padding: 9px 10px;
  color: var(--muted);
  background: rgba(255, 248, 252, 0.88);
  font-size: 0.8rem;
  line-height: 1.55;
}

.journal-entry time {
  display: block;
  margin-bottom: 3px;
  color: var(--pink-strong);
  font-size: 0.68rem;
  font-weight: 900;
}

.achievement-item {
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
}

.achievement-item.unlocked {
  color: var(--text);
  background: rgba(255, 244, 251, 0.98);
  border-color: rgba(231, 95, 158, 0.28);
}

.achievement-item strong {
  font-size: 0.9rem;
}

.achievement-item span {
  font-size: 0.78rem;
  line-height: 1.45;
}

.log-row {
  margin-top: 12px;
}

.log-list {
  display: grid;
  gap: 8px;
  max-height: 290px;
  overflow: auto;
  margin: 0;
  padding-left: 1.25rem;
  color: var(--muted);
  line-height: 1.55;
}

.log-list li::marker {
  color: var(--pink);
  font-weight: 900;
}

.share-button {
  width: 100%;
  min-height: 48px;
  margin: 12px 0 8px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--pink), var(--lavender));
  box-shadow: 0 10px 22px rgba(129, 119, 232, 0.2);
}

.x-share-button {
  margin-top: 0;
  background: linear-gradient(135deg, #19151f, #6b5fd8);
}

.share-text {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.84);
  line-height: 1.55;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(16px + var(--safe-bottom));
  z-index: 20;
  max-width: min(520px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: #ffffff;
  background: rgba(43, 38, 48, 0.86);
  box-shadow: 0 16px 38px rgba(43, 38, 48, 0.24);
  transform: translate(-50%, 18px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.mobile-nav {
  display: none;
}

@keyframes idleFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}

@keyframes talkBounce {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  42% {
    transform: translateY(-8px) scale(1.015);
  }
  72% {
    transform: translateY(1px) scale(0.995);
  }
}

@keyframes questPulse {
  0%,
  100% {
    box-shadow: 0 8px 24px rgba(231, 95, 158, 0.15);
  }
  50% {
    box-shadow: 0 9px 28px rgba(231, 95, 158, 0.27);
  }
}

@keyframes gachaRoll {
  0% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
  30% {
    transform: translateY(-7px) scale(0.985) rotate(-1.5deg);
    filter: brightness(1.08) saturate(1.12);
  }
  64% {
    transform: translateY(5px) scale(1.025) rotate(1.5deg);
    filter: brightness(1.18) saturate(1.18);
  }
  100% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
}

@keyframes gachaBurst {
  0% {
    opacity: 0;
    transform: scale(0.82);
  }
  36% {
    opacity: 1;
    transform: scale(1.03);
  }
  100% {
    opacity: 0;
    transform: scale(1.24);
  }
}

@media (min-width: 560px) {
  .page-shell {
    width: min(1160px, calc(100% - 32px));
    padding-top: 24px;
  }

  .primary-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .collection-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .site-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    margin-bottom: 16px;
  }

  h1 {
    font-size: 2.25rem;
  }

  .header-progress {
    min-width: 278px;
    max-width: 320px;
  }

  .game-layout {
    grid-template-columns: minmax(0, 1.04fr) minmax(340px, 0.96fr);
    gap: 18px;
  }

  .hero-card {
    position: sticky;
    top: 18px;
    padding: 14px;
  }

  .scene-frame {
    min-height: min(54vh, 510px);
  }

  .scene-copy h2 {
    font-size: 1.75rem;
  }

  .log-row {
    margin-top: 18px;
  }

  .collection-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 899px) {
  body {
    padding-bottom: calc(68px + var(--safe-bottom));
  }

  body[data-mobile-view="home"] [data-mobile-panel]:not([data-mobile-panel="home"]),
  body[data-mobile-view="collection"] [data-mobile-panel]:not([data-mobile-panel="collection"]),
  body[data-mobile-view="records"] [data-mobile-panel]:not([data-mobile-panel="records"]) {
    display: none !important;
  }

  .mobile-nav {
    position: fixed;
    z-index: 18;
    right: 10px;
    bottom: calc(8px + var(--safe-bottom));
    left: 10px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    border: 1px solid rgba(86, 62, 96, 0.2);
    border-radius: 20px;
    padding: 7px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 16px 38px rgba(43, 38, 48, 0.2);
    backdrop-filter: blur(12px);
  }

  .mobile-nav-button {
    min-height: 44px;
    border-radius: 14px;
    color: var(--muted);
    background: transparent;
    font-size: 0.82rem;
    font-weight: 900;
  }

  .mobile-nav-button.is-active {
    color: #ffffff;
    background: var(--lavender-strong);
  }

  .toast {
    bottom: calc(82px + var(--safe-bottom));
  }
}

@media (max-width: 559px) {
  .page-shell {
    padding-top: 12px;
  }

  .site-header {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 9px;
    margin-bottom: 12px;
  }

  .back-link {
    grid-column: 1;
    grid-row: 1;
  }

  .site-heading {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  h1 {
    margin-bottom: 6px;
    font-size: clamp(1.65rem, 8vw, 2rem);
  }

  .lead {
    font-size: 0.84rem;
    line-height: 1.6;
  }

  .header-progress {
    grid-column: 2;
    grid-row: 1;
    min-height: 46px;
    gap: 5px;
    padding: 7px 10px;
    font-size: 0.62rem;
  }

  .header-progress strong {
    font-size: 0.8rem;
  }

  .data-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .scene-frame {
    min-height: min(47vh, 390px);
  }

  .scene-image {
    max-height: min(49vh, 410px);
    padding: 4px;
  }

  .scene-reaction {
    top: 16%;
    left: 4%;
    width: min(40%, 142px);
    padding: 10px 8px;
    font-size: 0.68rem;
  }

  .scene-copy {
    padding-top: 10px;
  }

  .scene-copy h2 {
    margin-bottom: 5px;
    font-size: 1.25rem;
  }

  .scene-copy p {
    font-size: 0.86rem;
  }

  .primary-actions {
    margin-top: 10px;
  }

  .action-button {
    min-height: 46px;
    padding-inline: 5px;
  }

  .action-button span {
    font-size: 0.86rem;
  }

  .action-button small {
    font-size: 0.62rem;
  }

  .quest-steps {
    gap: 12px;
  }

  .quest-step {
    min-height: 84px;
    padding-inline: 4px;
  }

  .quest-step strong {
    font-size: 0.72rem;
  }

  .quest-reward {
    font-size: 0.72rem;
  }

  .status-title-row {
    align-items: flex-start;
  }

  .status-bonus {
    max-width: 150px;
  }

  .toast {
    font-size: 0.78rem;
    transform: translate(-50%, 12px);
  }

  .toast.is-visible {
    transform: translate(-50%, 0);
  }
}

@media (max-width: 380px) {
  .page-shell {
    width: min(100% - 14px, 680px);
  }

  .hero-card,
  .panel-card {
    padding: 10px;
  }

  .scene-frame {
    min-height: min(44vh, 350px);
  }

  .action-button {
    min-height: 44px;
    padding-inline: 5px;
  }

  .action-button span {
    font-size: 0.86rem;
  }

  .action-button small {
    font-size: 0.62rem;
  }

  .collection-tools,
  .collection-stats {
    grid-template-columns: 1fr;
  }

  .status-grid {
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
