:root {
  color-scheme: dark;
  font-family: "Yu Gothic UI", "Hiragino Sans", Meiryo, sans-serif;
  color: #f1f8ff;
  background: #050c1d;
  --line: #62d9ff;
  --line-soft: #51a9ee72;
  --gold: #ffdf8a;
  --ink: #071c3d;
  --muted: #a8c7e5;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, select { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid #fff0a2; outline-offset: -3px; }
button:disabled { opacity: .55; cursor: default; }
.shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  block-size: 100vh;
  block-size: 100dvh;
  max-inline-size: 430px;
  margin-inline: auto;
  background: var(--ink);
  box-shadow: 0 0 80px #1b50a155;
}
.hero {
  --hero-edge: max(8px, var(--safe-right));
  padding: var(--safe-top) var(--hero-edge) 0 max(8px, var(--safe-left));
  overflow: clip;
  background: linear-gradient(118deg, #394980 0%, #5c6ba2 25%, #bec6e8 47%, #e4e2f6 100%);
  border-block-end: 2px solid #faf0d9;
  box-shadow: 0 4px 14px #303c8096, inset 0 -3px 0 #c7cae8;
  z-index: 1;
}
.hero-top {
  --partner-label-size: clamp(.95rem, 4.7vw, 1.24rem);
  --hero-crest-size: clamp(28px, 8.5vw, 37px);
  display: grid;
  grid-template: 44px auto / calc(var(--hero-crest-size) + 5 * var(--partner-label-size) + 12px) minmax(0, 1fr) auto;
  column-gap: 6px;
}
.hero-identity {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-area: 1 / 1 / 3 / 2;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  padding-inline-end: 5px;
}
.hero-identity::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0 -12px 0 -55px;
  transform: skewX(-16deg);
  transform-origin: top right;
  border-inline-end: 2px solid #f6e4b7;
  border-end-end-radius: 18px;
  background: linear-gradient(137deg, #1e2758, #354986 84%);
  box-shadow: inset -3px -2px 0 #9baadb72, 2px 0 9px #37457b7d;
}
.partner-name {
  display: block;
  align-content: center;
  min-inline-size: 0;
  min-block-size: 44px;
  color: #fff;
  font-size: var(--partner-label-size);
  font-weight: 850;
  line-height: 1.12;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 2px 3px #101a46;
}
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: .62rem;
  font-weight: 750;
  letter-spacing: .13em;
}
.hero-crest {
  display: grid;
  place-items: center;
  inline-size: var(--hero-crest-size);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid #fbecd0;
  background: radial-gradient(#fff, #e4e9ff 67%, #a7addb);
  box-shadow: 0 0 8px #d0dbff82;
}
.hero-crest img { inline-size: 78%; block-size: 82%; object-fit: contain; }
#clock {
  grid-area: 2 / 3;
  justify-self: end;
  display: flex;
  align-items: baseline;
  justify-content: end;
  gap: 4px;
  margin-inline-end: calc(0px - var(--hero-edge));
  padding: 0 var(--hero-edge) 1px 6px;
  border-block-start: 1px solid #fff;
  border-start-start-radius: 14px;
  background: #f5f1ffb8;
  color: #282e62;
  font-size: .58rem;
  font-weight: 750;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
#clock strong { font-size: clamp(.86rem, 3.55vw, 1rem); line-height: 1; }
.wallet {
  grid-area: 1 / 2 / 3 / 3;
  justify-self: center;
  align-self: center;
  inline-size: min(100%, 130px);
  display: grid;
  gap: 2px;
}
.currency-add {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px;
  min-inline-size: 0;
  min-block-size: 24px;
  padding: 1px 3px;
  background: linear-gradient(126deg, #1c285b, #405b9a 63%, #233971);
  border: 1px solid #f8f2fd;
  border-radius: 24px;
  box-shadow: 0 2px 5px #30366b63, inset 0 1px 0 #ffffff80;
}
span.currency-add { grid-template-columns: auto minmax(0, 1fr); }
.wallet strong {
  text-align: center;
  min-inline-size: 0;
  white-space: nowrap;
  font-size: clamp(.72rem, 3.05vw, .9rem);
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.ui-icon { inline-size: 1em; block-size: 1em; flex: none; vertical-align: middle; }
.currency-icon {
  display: grid;
  place-items: center;
  inline-size: clamp(18px, 5vw, 22px);
  aspect-ratio: 1;
  border: 1px solid #ffffffa0;
  border-radius: 50%;
  font-size: .88rem;
}
.coin { color: #fff5c9; background: radial-gradient(circle at 25% 20%, #e5af62, #8f5623); }
.gem { color: #f2fdff; background: radial-gradient(circle at 25% 20%, #5dbbe4, #584397); }
.currency-plus {
  display: grid;
  place-items: center;
  inline-size: 16px;
  aspect-ratio: 1;
  border: 1px solid #d9e4ff;
  border-radius: 50%;
  color: #fff;
  font-size: .71rem;
  font-weight: 800;
}
.hero-tools { grid-area: 1 / 3; display: flex; justify-content: flex-end; }
.hero-tools button {
  display: grid;
  place-items: center;
  inline-size: 44px;
  min-block-size: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #29366b;
}
.hero-tools button span {
  display: grid;
  place-items: center;
  inline-size: 29px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid #fff;
  background: linear-gradient(145deg, #fff, #d3d9f5);
  box-shadow: 0 1px 5px #313a7773;
  font-size: 1.05rem;
}
main { min-inline-size: 0; overflow: auto; outline: none; }
main[data-page="home"] { container-type: size; }
.home {
  --button-size: clamp(70px, 21cqi, 108px);
  --train-extra: clamp(12px, 4cqi, 19px);
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template: auto minmax(min-content, 1fr) / minmax(0, 1fr) minmax(142px, 43%);
  gap: 9px;
  min-block-size: 100%;
  overflow: clip;
  padding: 9px max(10px, var(--safe-right)) 9px max(8px, var(--safe-left));
  background:
    linear-gradient(150deg, #061d5066, #0a2f7160 40%, #0e224471 76%, #051733b8),
    var(--home-backdrop, url('assets/room.png')) var(--home-backdrop-position, 16% center) / cover;
}
.watch {
  z-index: 1;
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  min-inline-size: 0;
  padding: 4px 5px;
  background: linear-gradient(150deg, #092658f5, #071d41f2);
  border: 1px solid #9fe6ff;
  border-radius: 9px 3px;
  box-shadow: inset 0 0 10px #0e90ff85, 0 0 11px #38b9ff;
}
.watch h2 {
  margin: 0;
  padding: 3px;
  background: linear-gradient(90deg, #144b93, #0d356a);
  border-block: 1px solid #96d9ffb0;
  font-size: clamp(.69rem, 2.9vw, .83rem);
  line-height: 1.2;
}
.watch h2 span, .measures i { color: #a9efff; }
.measures { margin: 0; font-size: .86rem; }
.measures > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1px .35em;
  border-block-end: 1px solid #a6dcf75c;
  padding: 8px 0;
}
.watch .measures { font-size: clamp(.65rem, 2.5vw, .81rem); line-height: 1.3; }
.watch .measures > div { padding: 3px 1px; }
.measures dt, .measures dd { margin: 0; }
.measures i { display: inline-block; min-inline-size: 1.15em; margin-inline-end: .15em; font-style: normal; }
.measures dd { margin-inline-start: auto; font-weight: 750; overflow-wrap: anywhere; }
.measures dd small { padding-inline-start: .23em; font-size: .78em; }
.watch-foot {
  display: flex;
  gap: 0 5px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: .66rem;
}
.watch-foot button, .watch-foot a {
  background: transparent;
  border: 0;
  min-block-size: 44px;
  padding: 2px 3px;
  font-size: .68rem;
  color: #def7ff;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.watch-foot a { display: inline-flex; align-items: center; }
.step-status {
  display: grid;
  padding: 4px 2px 0;
  color: var(--muted);
  font-size: .71rem;
}
.step-feedback { display: block; color: #def7ff; line-height: 1.4; }
dialog .step-feedback { margin-block-end: 8px; color: #d5edff; }
.step-latest { color: #bfe7ff; font-size: .86rem; }
.step-sync-actions a {
  display: inline-flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  min-block-size: 44px;
  padding: 7px 10px;
  border: 1px solid var(--gold);
  border-radius: 5px;
  background: #275591;
  font-weight: 750;
}
.step-setup {
  margin-block: 12px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  font-size: .83rem;
}
.step-setup summary { min-block-size: 32px; cursor: pointer; }
.step-setup li { margin-block-end: 6px; overflow-wrap: anywhere; }
.portrait {
  position: absolute;
  inset: auto auto 1% calc(var(--safe-left) - clamp(20px, 8.4cqi, 48px));
  inline-size: min(96cqi, 56cqb);
}
.home-with-partner .portrait {
  inset: auto auto -5cqb calc(var(--safe-left) - 10cqi);
  inline-size: min(82cqi, 59cqb);
}
.portrait button { display: block; width: 100%; padding: 0; border: 0; background: transparent; }
.portrait img {
  display: block;
  inline-size: 100%;
  block-size: auto;
  filter: drop-shadow(0 8px 10px #06173cc2);
}
img.outfit-ribbon { filter: hue-rotate(28deg) drop-shadow(0 8px 10px #06173cc2); }
.portrait.speaking img { animation: greet .25s ease-out; }
@keyframes greet { 50% { transform: translateY(-4px); } }
.bubble {
  position: absolute;
  inset: 5% auto auto 14%;
  z-index: 1;
  width: min(53%, 225px);
  margin: 0;
  padding: 7px;
  background: #f5fcff;
  border: 2px solid var(--line);
  border-radius: 10px;
  color: #102a50;
  text-align: center;
  font-size: .78rem;
  font-weight: 750;
  pointer-events: none;
}
.bubble::after {
  content: '';
  position: absolute;
  inset: 100% auto auto 38%;
  border: 7px solid transparent;
  border-block-start-color: var(--line);
}
.actions {
  grid-area: 2 / 2;
  z-index: 1;
  display: grid;
  justify-items: end;
  align-content: end;
  gap: clamp(6px, 1.5cqb, 12px);
  padding-block-end: clamp(0px, 5cqb, 40px);
  pointer-events: none;
}
.action {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: center;
  justify-content: center;
  inline-size: var(--button-size);
  min-block-size: 44px;
  aspect-ratio: 1;
  padding: 3px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 4%, #3dc8ff, #105caa 52%, #082a64);
  box-shadow: inset 0 0 0 2px #ffffff45, inset 0 1px 9px #fffcdd88, 0 3px 8px #0a1b4ba8;
  font-size: clamp(.95rem, 4.2cqi, 1.24rem);
  font-weight: 900;
  text-shadow: 0 2px 4px #110b48;
  pointer-events: auto;
}
.action:not(.train) { margin-inline-end: calc(var(--train-extra) / 2); }
.action span { font-size: 1.18em; line-height: 1.05; }
.action:active { filter: brightness(1.3); }
.action.maid {
  background: radial-gradient(ellipse at 50% 4%, #ff8fe5, #b4378b 55%, #65154e);
  font-size: clamp(.63rem, 3.5cqi, 1.08rem);
  white-space: nowrap;
}
.action.train {
  inline-size: calc(var(--button-size) + var(--train-extra));
  border-width: 3px;
  background: radial-gradient(ellipse at 50% 15%, #be99ff, #662cc1 52%, #301074 89%);
  box-shadow: inset 0 0 0 3px #fad7ff7e, inset 0 0 20px #f6aaffac, 0 0 0 3px #79dcff8c, 0 4px 15px #1c0e59bf;
  font-size: clamp(1.13rem, 5cqi, 1.6rem);
}
.ad {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  min-block-size: calc(50px + var(--safe-bottom));
  padding: 4px max(8px, var(--safe-right)) calc(4px + var(--safe-bottom)) max(8px, var(--safe-left));
  border-block-start: 2px solid var(--line);
  background: repeating-linear-gradient(125deg, #10264c, #10264c 12px, #102349 12px, #102349 24px);
  color: var(--muted);
}
.ad span {
  padding: 2px 5px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  font-size: .67rem;
  font-weight: bold;
}
.ad small { font-size: .7rem; }
.ad:has(.test-reset) { justify-content: start; }
.test-reset {
  min-block-size: 44px;
  margin-inline-start: auto;
  padding-inline: 7px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: #172e55;
  color: #eef7ff;
  font-size: .68rem;
}
.loading, .subpage {
  margin: 0;
  min-block-size: 100%;
  padding: 12px max(12px, var(--safe-right)) 24px max(12px, var(--safe-left));
  background: radial-gradient(ellipse at top, #16416f, #081d3e 62%);
}
.panel h2 { margin: 0; font-size: clamp(1.05rem, 4.8vw, 1.5rem); }
.panel, dialog {
  padding: clamp(12px, 4vw, 22px);
  border: 1px solid var(--line-soft);
  border-radius: 10px 3px;
  background: #081e3c;
  color: #f1f8ff;
  overflow-wrap: anywhere;
}
.panel p, dialog p { line-height: 1.6; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; }
.controls > button { flex: 1 1 auto; }
.controls > button, .primary, select {
  min-block-size: 44px;
  border-radius: 5px;
  border: 1px solid var(--line-soft);
  background: #102f55;
  padding: 8px 12px;
  font-weight: 700;
}
.primary, button[aria-pressed="true"]:not(.hex) { background: #275591; border-color: var(--gold); }
form .field { display: grid; gap: 5px; margin-block-end: 12px; }
dialog {
  width: min(430px, calc(100% - max(14px, var(--safe-left)) - max(14px, var(--safe-right))));
  max-height: calc(100% - max(12px, var(--safe-top)) - max(12px, var(--safe-bottom)));
  box-shadow: 0 0 24px #0e6bc66b;
}
dialog::backdrop { background: #020b1ccc; }
dialog h2 { margin: 0; font-size: 1.18rem; }
.dialog-error { color: #ffd6be; }
.dialog-error:empty { display: none; }
.public-footer { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 4px 15px; padding: 2px 10px max(2px, var(--safe-bottom)); border-block-start: 1px solid var(--line-soft); background: #102b54; }
.public-footer a { display: inline-flex; align-items: center; min-height: 44px; color: #eef4ff; }
.save-details div { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 8px 0; }
.save-details dd { margin: 0; font-weight: 700; text-align: end; }
.public-release #health-input input { width: 100%; min-height: 44px; padding: 5px 8px; font: inherit; }
.public-release .watch-foot { flex-wrap: wrap; }
#steps-form input, #profile-form input {
  display: block;
  inline-size: 100%;
  min-block-size: 44px;
  margin-block: 5px 12px;
  padding-inline: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: #102f55;
  color: inherit;
  font: inherit;
}
.settings-group { margin-block: 14px; padding: 10px; border: 1px solid var(--line-soft); border-radius: 8px; }
button.settings-reset { min-block-size: 44px; border: 1px solid #e29599; border-radius: 6px; padding: 7px 12px; background: #542839; color: #fff3f3; font-weight: 700; }
.settings-group h3, .settings-group p { margin: 0 0 6px; }
.settings-group a { display: flex; align-items: center; inline-size: fit-content; min-block-size: 44px; text-decoration: underline; text-underline-offset: .18em; }
.settings-name { flex-wrap: nowrap; }
#profile-form input { flex: 1; min-inline-size: 0; margin: 0; }
.reels { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-block-end: 16px; text-align: center; }
.reel-frame {
  --row: 40px;
  display: block;
  position: relative;
  margin-block-start: 4px;
  background: #09162d;
}
.reel-frame::after {
  content: '';
  pointer-events: none;
  position: absolute;
  inset: var(--row) 0;
  border-block: 1px solid var(--line);
  background: #8bcaff19;
}
.reel {
  display: block;
  block-size: calc(3 * var(--row));
  padding-block: var(--row);
  overflow: hidden;
  touch-action: none;
  user-select: none;
}
.reel > span { display: grid; place-items: center; block-size: var(--row); cursor: pointer; }
#notice {
  position: fixed;
  inset: auto max(12px, var(--safe-right)) calc(56px + var(--safe-bottom)) max(12px, var(--safe-left));
  width: fit-content;
  max-width: calc(100% - 24px);
  margin: 0 auto;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #061d37;
  text-align: center;
  pointer-events: none;
  z-index: 3;
}
@media (max-height: 650px) {
  .home { --button-size: 59px; --train-extra: 12px; gap: 4px; padding-block: 4px; }
  .watch { padding-block: 3px; }
  .watch .measures { line-height: 1.2; }
  .watch .measures > div { padding-block: 2px; }
  .portrait { inline-size: min(96cqi, 64cqb); }
  .actions { gap: 4px; padding-block: 0; }
}
@media (min-width: 600px) {
  .shell { max-block-size: 932px; }
}
@media (prefers-reduced-motion: reduce) {
  .portrait.speaking img { animation: none; }
}

/* Monthly health records share the watch's navy and cyan palette. */
.watch-controls { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px; margin-block-start:5px; }
.watch-controls .watch-calendar-button { grid-column:1 / -1; }
.watch-controls :is(a,button), .calendar-month button, .calendar-days button {
  display:grid; place-items:center; min-block-size:44px; min-inline-size:0; padding:2px;
  border:1px solid #80c5ee; border-radius:4px; background:linear-gradient(#1b4d84,#0c2c56);
  color:#f0faff; font-weight:750; text-decoration:none;
}
.watch-controls :is(a,button) { font-size:.74rem; }
.watch-controls :disabled { opacity:.52; }
.watch-sample { display:block; margin-block-start:3px; color:#b6dbf8; font-size:.61rem; }
.watch-calendar { color:#f4fbff; }
.calendar-panel {
  border:1px solid #77bce5; border-radius:10px; background:linear-gradient(155deg,#102b53,#0c203f);
  padding:8px; box-shadow:0 3px 16px #030f2870;
}
.calendar-month { display:grid; grid-template-columns:44px minmax(0,1fr) 44px; align-items:center; gap:4px; }
.calendar-month button { font-size:1.4rem; }
.calendar-month h2, .calendar-detail h2 { margin:0; font-size:1rem; line-height:1.45; }
.calendar-month h2 { text-align:center; }
.calendar-grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:3px; }
.calendar-weekdays { margin-block:8px 3px; color:#c3e8fa; text-align:center; font-size:.76rem; }
.calendar-days { grid-template-rows: repeat(6, minmax(44px, 1fr)); }
.calendar-days button { position:relative; font-size:.92rem; background:#112c53; border-color:#487ea6; }
.calendar-days button[aria-current="date"] { color:#fff1a8; border-color:#d7c77d; }
.calendar-days button[aria-pressed="true"] { background:#235b94; outline:2px solid #a3e7ff; outline-offset:-2px; }
.calendar-days button:focus-visible { outline:2px solid white; outline-offset:-3px; }
.calendar-dot { display:inline-block; width:5px; height:5px; border-radius:50%; background:#8de6ef; }
.calendar-days .calendar-dot { position:absolute; inset-block-end:4px; }
.calendar-legend { margin:6px 1px 1px; color:#d0ebfb; font-size:.72rem; }
.calendar-detail .measures > div { padding:6px 0; }
.calendar-detail .measures > div:last-child { border-bottom:0; }
.badge-catalog li .badge-status { display:inline-block; color:#b6effc; font-size:.68rem; font-weight:750; margin-block-start:3px; }
.attack-box[data-badge-active="true"] .medal-art { filter:drop-shadow(0 0 5px #a6d5ff); }

@media (max-height: 650px) {
  .home:has(.watch-controls) { --button-size: 48px; }
  .home:has(.watch-controls) .actions {
    grid-template-columns: repeat(2, var(--button-size));
    justify-content: end;
    column-gap: 6px;
  }
  .home:has(.watch-controls) .action:not(.train) { margin-inline-end: 0; }
  .home:has(.watch-controls) .train { grid-column: 1 / -1; }
  .home:has(.watch-controls) .watch h2 { margin-block: 3px 1px; }
  .home:has(.watch-controls) .watch .measures > div { padding-block: 1px; }
}
