:root {
  --background: #fff8ef;
  --surface: #fffdf9;
  --surface-strong: #fff8f4;
  --pink: #ef8f9c;
  --pink-dark: #c95f72;
  --pink-soft: #ffe4e7;
  --brown: #7c4f3c;
  --brown-soft: #b98368;
  --text: #4d392f;
  --muted: #806d63;
  --gold: #e8ab59;
  --gold-soft: #fff0c9;
  --blue: #7aa8b8;
  --blue-soft: #dceff2;
  --line: rgba(124, 79, 60, 0.12);
  --shadow: 0 24px 60px rgba(124, 79, 60, 0.13);
  --shadow-small: 0 10px 28px rgba(124, 79, 60, 0.1);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --font-display: "Trebuchet MS", "Arial Rounded MT Bold", system-ui, sans-serif;
  --font-body: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --page-background:
    radial-gradient(circle at 10% 15%, rgba(255, 214, 193, 0.62), transparent 28rem),
    radial-gradient(circle at 88% 5%, rgba(248, 190, 205, 0.45), transparent 25rem),
    linear-gradient(145deg, #fff8ef 0%, #fff2ed 45%, #fdf7ed 100%);
  --room-wall-start: #f9c9c6;
  --room-wall-end: #f8d8c8;
  --room-floor: #efd0ad;
  --window-sky-start: #8cb3be;
  --window-sky-end: #d5e6df;
  --window-ground: #ffe3a7;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background: var(--page-background);
  background-attachment: fixed;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  transition: background-color 0.8s ease, color 0.5s ease;
}

body[data-time-theme="morning"] {
  --page-background:
    radial-gradient(circle at 12% 12%, rgba(255, 221, 151, 0.74), transparent 29rem),
    radial-gradient(circle at 88% 8%, rgba(255, 188, 197, 0.5), transparent 25rem),
    linear-gradient(145deg, #fff8e8 0%, #fff0e9 48%, #fef8ef 100%);
  --room-wall-start: #f8c8bd;
  --room-wall-end: #f9ddc3;
  --room-floor: #efd0a6;
  --window-sky-start: #f3a998;
  --window-sky-end: #ffe1ae;
  --window-ground: #fff0b8;
}

body[data-time-theme="afternoon"] {
  --page-background:
    radial-gradient(circle at 13% 14%, rgba(255, 233, 154, 0.62), transparent 28rem),
    radial-gradient(circle at 88% 7%, rgba(155, 215, 238, 0.58), transparent 27rem),
    linear-gradient(145deg, #f4fbff 0%, #edf8ff 45%, #fff8e8 100%);
  --room-wall-start: #bcddeb;
  --room-wall-end: #dcecf0;
  --room-floor: #e8d2ac;
  --window-sky-start: #68acd0;
  --window-sky-end: #c7e8ef;
  --window-ground: #ffe9a4;
}

body[data-time-theme="evening"] {
  --page-background:
    radial-gradient(circle at 14% 15%, rgba(242, 154, 190, 0.25), transparent 28rem),
    radial-gradient(circle at 88% 7%, rgba(126, 151, 224, 0.32), transparent 27rem),
    linear-gradient(145deg, #28243f 0%, #443653 48%, #262b45 100%);
  --room-wall-start: #b590b1;
  --room-wall-end: #d4abb1;
  --room-floor: #c8a17f;
  --window-sky-start: #354370;
  --window-sky-end: #6d668c;
  --window-ground: #f2cc8f;
}

body[data-time-theme="evening"] .site-header h1 {
  color: #fff8fb;
  text-shadow: 0 5px 24px rgba(12, 8, 28, 0.28);
}

body[data-time-theme="evening"] .site-header .eyebrow {
  color: #ffd3df;
}

body[data-time-theme="evening"] .motivation,
body[data-time-theme="evening"] footer {
  color: rgba(255, 246, 249, 0.82);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(201, 95, 114, 0.4);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 10px 16px;
  transform: translateY(-150%);
  border-radius: 12px;
  color: #fff;
  background: var(--brown);
  text-decoration: none;
}

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

.page-glow {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(6px);
  pointer-events: none;
}

.page-glow--one {
  width: 220px;
  height: 220px;
  top: 23%;
  left: -90px;
  background: rgba(255, 229, 186, 0.5);
}

.page-glow--two {
  width: 280px;
  height: 280px;
  right: -110px;
  bottom: 8%;
  background: rgba(245, 178, 190, 0.28);
}

.page-shell {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 40px 0 28px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
  padding: 0 4px;
}

.site-header h1,
.room-card h2,
.focus-card h2,
.achievement-card h2,
.modal h2 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: -0.035em;
}

.site-header h1 {
  font-size: clamp(1.9rem, 4vw, 3.25rem);
  line-height: 1.12;
}

.eyebrow,
.tiny-label,
.letter-kicker {
  margin: 0 0 5px;
  color: var(--pink-dark);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.motivation {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.letter-button,
.sound-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid rgba(201, 95, 114, 0.16);
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.82);
  box-shadow: var(--shadow-small);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.letter-button:hover,
.sound-button:hover {
  transform: translateY(-2px);
  background: #fff;
  box-shadow: 0 14px 30px rgba(124, 79, 60, 0.15);
}

.sound-button.is-on {
  border-color: rgba(122, 168, 184, 0.28);
  background: rgba(237, 250, 252, 0.92);
}

.sound-button.is-on .sound-icon {
  animation: sound-bob 1.8s ease-in-out infinite;
}

.companion-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.38fr) minmax(340px, 0.82fr);
  align-items: start;
  gap: 24px;
}

.room-card,
.focus-card,
.achievement-card {
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.room-card {
  position: relative;
  overflow: hidden;
  min-height: 690px;
  padding: 28px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 14% 25%, rgba(255, 255, 255, 0.72) 0 2px, transparent 3px),
    radial-gradient(circle at 87% 17%, rgba(255, 255, 255, 0.6) 0 2px, transparent 3px),
    linear-gradient(
      180deg,
      var(--room-wall-start) 0%,
      var(--room-wall-end) 54%,
      var(--room-floor) 54%,
      var(--room-floor) 100%
    );
  background-size: 88px 88px, 110px 110px, 100% 100%;
  transition: background-color 0.8s ease;
}

.room-card::before {
  content: "";
  position: absolute;
  inset: 54% 0 auto;
  height: 1px;
  background: rgba(124, 79, 60, 0.1);
}

.room-card::after {
  content: "";
  position: absolute;
  top: 132px;
  right: 4%;
  width: 118px;
  height: 152px;
  border: 10px solid rgba(255, 250, 238, 0.72);
  border-radius: 70px 70px 18px 18px;
  background: linear-gradient(
    180deg,
    var(--window-sky-start) 0%,
    var(--window-sky-end) 55%,
    var(--window-ground) 56%,
    var(--window-ground) 100%
  );
  box-shadow: inset 0 0 0 1px rgba(124, 79, 60, 0.09), 0 10px 20px rgba(124, 79, 60, 0.08);
  opacity: 0.7;
}

.room-topline,
.achievement-title-row,
.today-heading {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.room-topline h2 {
  font-size: 2rem;
}

.online-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(124, 79, 60, 0.09);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.58);
  color: #6b584f;
  font-size: 0.82rem;
  font-weight: 700;
}

.online-pill i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #71a77e;
  box-shadow: 0 0 0 4px rgba(113, 167, 126, 0.14);
}

.cat-stage {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  height: 385px;
  margin-top: 6px;
}

.speech-bubble {
  position: absolute;
  z-index: 4;
  top: 2px;
  left: 7%;
  width: min(285px, 65%);
  padding: 13px 17px;
  border: 1px solid rgba(124, 79, 60, 0.1);
  border-radius: 18px 18px 18px 5px;
  background: rgba(255, 253, 249, 0.94);
  box-shadow: var(--shadow-small);
  color: #654b40;
  font-weight: 650;
  line-height: 1.4;
  transform-origin: bottom left;
}

.speech-bubble.is-changing {
  animation: bubble-pop 0.32s ease;
}

.cat-character {
  position: relative;
  z-index: 3;
  align-self: end;
  width: min(310px, 72%);
  margin-bottom: 13px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transform-origin: 50% 90%;
}

.cat-character img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 18px 18px rgba(101, 61, 41, 0.18));
  user-select: none;
  -webkit-user-drag: none;
}

.cat-character.state-idle {
  animation: gentle-float 3.2s ease-in-out infinite;
}

.cat-character.state-happy,
.cat-character.state-eating {
  animation: happy-bounce 0.55s ease 2;
}

.cat-character.state-playing {
  animation: playful-wiggle 0.75s ease 2;
}

.cat-character.state-hungry {
  animation: hungry-look 2.2s ease-in-out infinite;
  filter: saturate(0.88);
}

.cat-character.state-sad {
  animation: sad-droop 2.8s ease-in-out infinite;
}

.cat-character.state-sad img {
  filter: saturate(0.58) brightness(0.94) drop-shadow(0 18px 18px rgba(101, 61, 41, 0.15));
}

.cat-character.state-sleepy {
  animation: sleepy-breathe 2.4s ease-in-out infinite;
}

.cat-character.state-studying {
  animation: studying-breathe 4s ease-in-out infinite;
}

.cat-character.state-annoyed {
  animation: annoyed-shake 0.42s ease 2;
}

.cat-prop {
  position: absolute;
  z-index: 5;
  top: 34%;
  right: 2%;
  font-size: 2.3rem;
  filter: drop-shadow(0 5px 8px rgba(124, 79, 60, 0.16));
}

.cat-outfit,
.cat-expression {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  line-height: 1;
  filter: drop-shadow(0 5px 7px rgba(92, 55, 40, 0.22));
}

.cat-outfit {
  display: none;
  font-size: clamp(2.4rem, 6vw, 4rem);
}

.cat-character[data-outfit="bow"] .cat-outfit {
  display: block;
  top: 14%;
  left: 17%;
  transform: rotate(-18deg);
}

.cat-character[data-outfit="crown"] .cat-outfit {
  display: block;
  top: -2%;
  left: 51%;
  transform: translateX(-50%) rotate(4deg);
}

.cat-character[data-outfit="glasses"] .cat-outfit {
  display: block;
  top: 29%;
  left: 49%;
  font-size: clamp(2.9rem, 7vw, 4.6rem);
  transform: translateX(-50%) rotate(-2deg);
}

.cat-character[data-outfit="scarf"] .cat-outfit {
  display: block;
  top: 48%;
  left: 49%;
  font-size: clamp(3rem, 7vw, 4.7rem);
  transform: translateX(-50%) rotate(7deg);
}

.cat-character[data-outfit="flower"] .cat-outfit {
  display: block;
  top: 17%;
  right: 14%;
  transform: rotate(16deg);
}

.cat-expression {
  top: 27%;
  left: -4%;
  display: grid;
  place-items: center;
  min-width: 48px;
  min-height: 48px;
  padding: 6px;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  background: rgba(255, 253, 249, 0.9);
  font-size: clamp(1.45rem, 4vw, 2rem);
  opacity: 0;
  transform: scale(0.72);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.cat-expression:not(:empty) {
  opacity: 1;
  transform: scale(1);
  animation: expression-pop 0.32s ease;
}

.soft-rug {
  position: absolute;
  z-index: 0;
  bottom: 4px;
  width: 72%;
  height: 84px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  background: rgba(255, 240, 202, 0.72);
  box-shadow: inset 0 6px 18px rgba(255, 255, 255, 0.42), 0 12px 24px rgba(124, 79, 60, 0.08);
}

.sparkle {
  position: absolute;
  z-index: 2;
  color: rgba(255, 253, 245, 0.86);
  font-size: 1.75rem;
}

.sparkle--one {
  top: 34%;
  left: 14%;
}

.sparkle--two {
  top: 49%;
  right: 11%;
  font-size: 1.15rem;
}

.status-panel {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  background: rgba(255, 252, 246, 0.82);
  backdrop-filter: blur(12px);
}

.status-row {
  padding: 4px 7px;
}

.status-copy {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.83rem;
  font-weight: 750;
}

.status-copy strong {
  font-size: 0.8rem;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(124, 79, 60, 0.11);
}

.progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 0.4s ease, background 0.35s ease, filter 0.35s ease;
}

.progress-fill--pink { background: var(--pink); }
.progress-fill--gold { background: var(--gold); }
.progress-fill--blue { background: var(--blue); }

.progress-track.is-low .progress-fill {
  background: linear-gradient(90deg, #f3b34f, #e88762);
}

.progress-track.is-critical .progress-fill {
  background: linear-gradient(90deg, #e36b70, #c84f63);
  animation: critical-pulse 1.2s ease-in-out infinite;
}

.wardrobe-panel {
  position: relative;
  z-index: 4;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(124, 79, 60, 0.1);
  border-radius: var(--radius-lg);
  background: rgba(255, 252, 246, 0.76);
  backdrop-filter: blur(12px);
}

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

.wardrobe-heading-row h3 {
  margin: 1px 0 0;
  font-size: 1rem;
}

.remove-outfit-button {
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid rgba(124, 79, 60, 0.13);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
  cursor: pointer;
}

.remove-outfit-button:disabled {
  cursor: default;
  opacity: 0.45;
}

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

.outfit-button {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 66px;
  padding: 7px 5px;
  border: 1px solid rgba(124, 79, 60, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.outfit-button > span {
  font-size: 1.5rem;
  line-height: 1;
}

.outfit-button small {
  font-size: 0.67rem;
  font-weight: 750;
  line-height: 1.15;
}

.outfit-button:hover {
  transform: translateY(-2px);
  background: #fff;
}

.outfit-button.is-selected {
  border-color: rgba(221, 111, 133, 0.52);
  background: #fff2f4;
  box-shadow: 0 0 0 3px rgba(237, 145, 162, 0.13);
}

.action-grid {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.action-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 10px;
  border: 1px solid rgba(124, 79, 60, 0.1);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 249, 0.92);
  box-shadow: 0 5px 0 rgba(164, 101, 72, 0.12);
  font-weight: 750;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.action-button:hover {
  transform: translateY(-2px);
  background: #fff;
  box-shadow: 0 8px 0 rgba(164, 101, 72, 0.1);
}

.action-button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(164, 101, 72, 0.12);
}

.action-icon {
  font-size: 1.15rem;
}

.side-column {
  display: grid;
  gap: 18px;
}

.focus-card,
.achievement-card {
  padding: 25px;
  border-radius: var(--radius-xl);
  background: rgba(255, 253, 249, 0.88);
  backdrop-filter: blur(14px);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 13px;
}

.section-heading h2,
.achievement-card h2 {
  font-size: 1.45rem;
}

.book-stamp {
  display: grid;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(201, 95, 114, 0.11);
  border-radius: 16px;
  background: var(--pink-soft);
  font-size: 1.35rem;
  transform: rotate(-3deg);
}

.focus-open-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  margin-top: 20px;
  padding: 0 19px;
  border: 0;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--pink-dark), #df8390);
  box-shadow: 0 12px 25px rgba(201, 95, 114, 0.25);
  font-family: var(--font-display);
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.focus-open-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(201, 95, 114, 0.3);
}

.focus-panel {
  margin-top: 13px;
  padding: 18px;
  border: 1px solid rgba(124, 79, 60, 0.08);
  border-radius: 20px;
  background: #fff8f6;
  text-align: center;
  animation: panel-in 0.3s ease;
}

[hidden] {
  display: none !important;
}

.focus-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.duration-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 15px;
  padding: 10px 12px;
  border: 1px solid rgba(124, 79, 60, 0.1);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.82);
  text-align: left;
}

.duration-setting label {
  color: var(--brown);
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 800;
}

.duration-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.duration-input-wrap input {
  width: 68px;
  min-height: 40px;
  padding: 6px 8px;
  border: 1px solid rgba(124, 79, 60, 0.2);
  border-radius: 11px;
  color: var(--brown);
  background: #fff;
  font: 800 1rem var(--font-display);
  text-align: center;
}

.duration-input-wrap input:disabled {
  color: var(--muted);
  background: #f6efec;
  cursor: not-allowed;
}

.session-counting-rule {
  margin: 9px 4px 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.timer-display {
  display: block;
  margin: 9px 0;
  color: var(--brown);
  font-family: var(--font-display);
  font-size: clamp(3rem, 7vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.07em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.timer-controls {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 8px;
}

.timer-button {
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid rgba(124, 79, 60, 0.12);
  border-radius: 13px;
  background: #fff;
  font-weight: 750;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.timer-button:hover {
  transform: translateY(-1px);
  background: #fffdfb;
}

.timer-button--primary {
  border-color: var(--brown);
  color: #fff;
  background: var(--brown);
}

.timer-button--primary:hover {
  background: #6e4433;
}

.timer-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.today-card {
  margin-top: 16px;
  padding: 18px;
  border: 1px dashed rgba(124, 79, 60, 0.18);
  border-radius: 20px;
  background: #fffaf1;
}

.today-heading {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.study-numbers {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin: 17px 0 12px;
  text-align: center;
}

.study-numbers div:not(.study-divider) {
  display: grid;
  gap: 1px;
}

.study-numbers strong {
  font-family: var(--font-display);
  font-size: 1.6rem;
}

.study-numbers span {
  color: var(--muted);
  font-size: 0.72rem;
}

.study-divider {
  width: 1px;
  height: 34px;
  background: var(--line);
}

#gentleProgress {
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.45;
}

.achievement-card {
  padding-top: 22px;
  padding-bottom: 20px;
}

.achievement-count {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--pink-dark);
  background: var(--pink-soft);
  font-size: 0.75rem;
  font-weight: 800;
}

.achievement-list {
  display: grid;
  gap: 4px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.achievement-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 14px;
  opacity: 0.57;
  transition: opacity 0.3s ease, background 0.3s ease, transform 0.3s ease;
}

.achievement-list li.is-unlocked {
  background: #fff7e2;
  opacity: 1;
}

.achievement-list li.is-new {
  animation: achievement-pulse 0.8s ease;
}

.badge-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 12px;
  background: rgba(124, 79, 60, 0.07);
}

.achievement-list li.is-unlocked .badge-icon {
  background: var(--gold-soft);
}

.achievement-list strong,
.achievement-list small {
  display: block;
}

.achievement-list strong {
  font-size: 0.84rem;
}

.achievement-list small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.72rem;
}

.lock-icon {
  color: var(--muted);
  font-weight: 800;
}

.achievement-list li.is-unlocked .lock-icon {
  color: #9c7435;
}

footer {
  padding: 25px 6px 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

footer p {
  margin: 0;
}

.reset-progress-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  margin-top: 12px;
  padding: 0 14px;
  border: 1px solid rgba(124, 79, 60, 0.16);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.64);
  font-size: 0.82rem;
  font-weight: 750;
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.reset-progress-button:hover {
  color: var(--brown);
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
}

body[data-time-theme="evening"] .reset-progress-button {
  border-color: rgba(255, 255, 255, 0.22);
  color: rgba(255, 246, 249, 0.86);
  background: rgba(255, 255, 255, 0.1);
}

.modal {
  width: min(560px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 28px;
  color: var(--text);
  background: transparent;
}

.modal::backdrop {
  background: rgba(79, 48, 38, 0.35);
  backdrop-filter: blur(5px);
  animation: backdrop-in 0.3s ease;
}

.modal[open] .modal-paper {
  animation: modal-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal-paper {
  position: relative;
  max-height: calc(100dvh - 32px);
  padding: clamp(30px, 6vw, 50px);
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 28px;
  background:
    repeating-linear-gradient(0deg, rgba(201, 95, 114, 0.045) 0 1px, transparent 1px 28px),
    #fffaf3;
  box-shadow: 0 32px 80px rgba(83, 48, 37, 0.25);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  font-size: 1.45rem;
  cursor: pointer;
}

.letter-seal {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 20px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--pink-dark);
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.14);
  transform: rotate(-7deg);
}

.modal h2 {
  margin-bottom: 20px;
  font-size: 2rem;
}

.letter-copy {
  color: #634d42;
  line-height: 1.75;
  white-space: pre-line;
}

.celebration-paper {
  text-align: center;
}

.celebration-icon {
  margin-bottom: 10px;
  font-size: 3.5rem;
}

.celebration-paper p:not(.letter-kicker) {
  color: var(--muted);
}

.reset-paper {
  text-align: center;
}

.reset-icon {
  margin-bottom: 8px;
  color: var(--pink-dark);
  font-size: 3.4rem;
  font-weight: 800;
  line-height: 1;
}

.reset-paper > p:not(.letter-kicker) {
  color: var(--muted);
  line-height: 1.65;
}

.reset-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 9px;
  margin-top: 20px;
}

.timer-button--danger {
  border-color: #b64d61;
  color: #fff;
  background: #b64d61;
}

.timer-button--danger:hover {
  background: #9f3e51;
}

.modal-done {
  width: 100%;
  margin-top: 12px;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  display: grid;
  width: min(360px, calc(100% - 44px));
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 15px 17px;
  border: 1px solid rgba(124, 79, 60, 0.1);
  border-radius: 18px;
  background: #fffdf8;
  box-shadow: 0 18px 45px rgba(83, 48, 37, 0.2);
  animation: toast-in 0.35s ease both;
}

.toast.is-leaving {
  animation: toast-out 0.25s ease both;
}

.toast strong,
.toast small {
  display: block;
}

.toast strong {
  font-size: 0.88rem;
}

.toast small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

@keyframes gentle-float {
  0%, 100% { transform: translateY(0) rotate(-0.4deg); }
  50% { transform: translateY(-7px) rotate(0.4deg); }
}

@keyframes happy-bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-16px) scale(1.03); }
}

@keyframes playful-wiggle {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  25% { transform: rotate(-4deg) translateY(-8px); }
  75% { transform: rotate(4deg) translateY(-8px); }
}

@keyframes hungry-look {
  0%, 100% { transform: translateX(0) rotate(0); }
  50% { transform: translateX(-4px) rotate(-1deg); }
}

@keyframes sad-droop {
  0%, 100% { transform: translateY(7px) rotate(-1deg) scale(0.98); }
  50% { transform: translateY(10px) rotate(1deg) scale(0.975); }
}

@keyframes sleepy-breathe {
  0%, 100% { transform: scale(1) translateY(3px); filter: saturate(0.8); }
  50% { transform: scale(1.018) translateY(5px); filter: saturate(0.72); }
}

@keyframes studying-breathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@keyframes annoyed-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px) rotate(-2deg); }
  75% { transform: translateX(7px) rotate(2deg); }
}

@keyframes bubble-pop {
  0% { transform: scale(0.92); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes expression-pop {
  0% { transform: scale(0.72) rotate(-8deg); }
  75% { transform: scale(1.08) rotate(3deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes critical-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.18); }
}

@keyframes panel-in {
  from { transform: translateY(-8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes achievement-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.025); }
}

@keyframes backdrop-in { from { opacity: 0; } }

@keyframes modal-in {
  from { transform: translateY(18px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes toast-in {
  from { transform: translateY(14px); opacity: 0; }
}

@keyframes toast-out {
  to { transform: translateY(10px); opacity: 0; }
}

@keyframes sound-bob {
  0%, 100% { transform: rotate(-5deg) scale(1); }
  50% { transform: rotate(6deg) scale(1.08); }
}

@media (max-width: 880px) {
  .companion-layout {
    grid-template-columns: 1fr;
  }

  .side-column {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .room-card {
    min-height: 660px;
  }
}

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

  .site-header {
    align-items: flex-start;
    margin-bottom: 18px;
  }

  .header-actions {
    gap: 7px;
  }

  .header-actions .control-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .letter-button,
  .sound-button {
    width: 48px;
    padding: 0;
    justify-content: center;
  }

  .room-card {
    min-height: 0;
    padding: 20px 16px 17px;
    border-radius: 26px;
  }

  .room-card::after {
    top: 116px;
    right: 0;
    width: 82px;
    height: 118px;
  }

  .online-pill {
    padding: 7px 9px;
    font-size: 0.7rem;
  }

  .cat-stage {
    height: 350px;
  }

  .speech-bubble {
    left: 0;
    width: min(270px, 78%);
    font-size: 0.9rem;
  }

  .cat-character {
    width: min(270px, 78%);
  }

  .status-panel {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 12px;
  }

  .status-row {
    display: grid;
    grid-template-columns: 118px 1fr;
    align-items: center;
    gap: 8px;
  }

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

  .status-copy {
    margin: 0;
  }

  .action-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .action-button {
    min-height: 54px;
  }

  .side-column {
    grid-template-columns: 1fr;
  }

  .focus-card,
  .achievement-card {
    padding: 21px 18px;
    border-radius: 26px;
  }

  .toast-region {
    right: 12px;
    bottom: 12px;
    width: calc(100% - 24px);
  }
}

@media (max-width: 390px) {
  .site-header h1 { font-size: 1.75rem; }
  .motivation { font-size: 0.9rem; }
  .cat-stage { height: 325px; }
  .cat-character { width: 245px; }
  .online-pill { max-width: 116px; line-height: 1.2; }
  .study-numbers { gap: 6px; }
  .study-numbers strong { font-size: 1.35rem; }
  .timer-controls { grid-template-columns: 1fr; }
  .reset-modal-actions { grid-template-columns: 1fr; }
}

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