:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #292a28;
  background: #d9dedc;
  font-synthesis: weight;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 0;
  min-height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #d9dedc;
}

.desktop-runtime,
.desktop-runtime body {
  background: transparent;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:focus:not(:focus-visible) {
  outline: none;
}

button:focus-visible {
  outline: 2px solid #3c78d8;
  outline-offset: 2px;
}

.app-shell {
  position: relative;
  isolation: isolate;
  width: min(680px, 100vw);
  height: min(340px, 100vh);
  padding: 20px;
  display: grid;
  grid-template-columns: 278px 352px;
  gap: 10px;
  border: 1px solid #6d6e6b;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0) 18%),
    linear-gradient(100deg, #bfc0bc 0%, #f2f0e9 14%, #d5d3cc 36%, #f4f1e9 65%, #b9bab7 100%);
  box-shadow:
    0 18px 42px rgba(28, 30, 29, 0.28),
    inset 0 0 0 3px rgba(255, 255, 255, 0.66),
    inset 0 0 0 6px rgba(91, 91, 87, 0.26);
  overflow: hidden;
  -webkit-app-region: drag;
}

.app-shell::before {
  content: "";
  position: absolute;
  inset: 11px;
  z-index: -1;
  border: 1px solid rgba(88, 86, 79, 0.45);
  border-radius: 20px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.65);
  pointer-events: none;
}

.resize-handle {
  position: absolute;
  right: 7px;
  bottom: 7px;
  z-index: 30;
  width: 22px;
  height: 22px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  color: rgba(67, 69, 65, 0.62);
  background: transparent;
  cursor: nwse-resize;
  touch-action: none;
  -webkit-app-region: no-drag;
}

.resize-handle[hidden] {
  display: none;
}

.resize-handle:hover {
  color: #252824;
}

.resize-handle svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
}

.is-resizing,
.is-resizing * {
  cursor: nwse-resize !important;
  user-select: none !important;
}

body:has(dialog[open]) .app-shell {
  border-radius: 10px;
}

body:has(dialog[open]) .app-shell::before {
  border-radius: 6px;
}

.metrics-column {
  min-width: 0;
  display: grid;
  grid-template-rows: 44px minmax(140px, 1fr) 46px auto;
  gap: 8px;
}

.status-strip {
  position: relative;
  z-index: 2;
  min-width: 0;
  margin-left: 30px;
  margin-right: 30px;
  padding: 0 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid #262826;
  border-radius: 8px;
  color: #e2e3df;
  background: #171918;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.08),
    0 0 0 3px #d6d3ca,
    0 0 0 4px #85857f;
}

.status-strip::before,
.status-strip::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 11px;
  height: 11px;
  border: 2px solid #4c524c;
  border-radius: 50%;
  background: #55e653;
  box-shadow:
    0 0 0 3px #d8d6cd,
    0 0 0 4px #6e706c,
    0 0 7px rgba(76, 241, 82, 0.86),
    inset 0 1px 2px rgba(255, 255, 255, 0.9);
  transform: translateY(-50%);
}

.status-strip::before {
  left: -25px;
}

.status-strip::after {
  right: -25px;
}

.status-strip span {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.status-strip strong,
.rate,
.money-line strong,
.amount-screen strong,
.time-strip strong {
  font-family: "SFMono-Regular", Menlo, Monaco, "Courier New", monospace;
  font-variant-numeric: tabular-nums;
}

.status-strip strong {
  color: #f0f1ed;
  font-size: 15px;
  font-weight: 500;
}

.digital-display {
  font-family: "DSEG7 Classic", "SFMono-Regular", Menlo, Monaco, monospace !important;
  font-weight: 400 !important;
  letter-spacing: 0;
}

.money-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: 40px minmax(0, 1fr);
  gap: 8px;
}

.rate-strip,
.time-strip {
  border: 1px solid #8b8982;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.04)),
    #ddd9d0;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.52),
    0 1px 2px rgba(46, 45, 42, 0.2);
}

.rate-strip {
  min-width: 0;
  padding: 0 13px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.rate-strip > span {
  color: #353633;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.rate {
  position: static;
  color: #2f312f;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.rate-negative {
  color: #9f3733;
}

.amount-screen {
  min-width: 0;
  min-height: 0;
  padding: 10px 13px 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid #222421;
  border-radius: 8px;
  color: #dedfdb;
  background: #171918;
  box-shadow:
    inset 0 0 20px rgba(0, 0, 0, 0.34),
    inset 0 0 0 2px rgba(255, 255, 255, 0.06),
    0 0 0 3px #d9d6cd,
    0 0 0 4px #84847f;
  overflow: hidden;
}

.currency-symbol {
  height: 30px;
  display: inline-flex;
  align-items: center;
  color: #e0e1dd;
  font-family: "SFMono-Regular", Menlo, Monaco, monospace;
  font-size: 30px;
  line-height: 1;
  font-weight: 600;
  transform: translateY(7px);
}

.amount-screen strong {
  min-width: 0;
  width: 100%;
  align-self: center;
  overflow: hidden;
  color: #e7e8e4;
  font-size: 56px;
  line-height: 1;
  font-weight: 400;
  white-space: nowrap;
  text-shadow:
    0 1px 1px rgba(255, 255, 255, 0.15),
    0 0 5px rgba(238, 241, 234, 0.12);
}

.amount-screen .amount-visibility-button {
  flex: none;
  width: 30px;
  height: 30px;
  align-self: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #dcddd9;
  background: transparent;
  transform: translateY(7px);
  -webkit-app-region: no-drag;
}

.amount-screen .amount-visibility-button:hover {
  color: #72db75;
  background: transparent;
}

.amount-screen .amount-visibility-button span {
  display: contents;
}

.amount-screen .amount-visibility-button img {
  width: 30px;
  height: 30px;
  display: block;
  opacity: 0.88;
  filter: invert(92%);
  transition: opacity 140ms ease;
}

.amount-screen .amount-visibility-button:hover img {
  opacity: 1;
}

.time-strip {
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #353633;
  font-size: 12px;
  font-weight: 600;
}

.time-strip strong {
  color: #333432;
  font-size: 15px;
  font-weight: 600;
}

.claim-button {
  width: 100%;
  min-height: 34px;
  border: 1px solid #b68143;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #543817;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.38) 30%, rgba(255, 255, 255, 0) 48%),
    linear-gradient(180deg, #fffdf3 0%, #f2e1bb 38%, #dfbd87 68%, #c48c50 100%);
  font-size: 14px;
  font-weight: 700;
  text-shadow: 0 1px rgba(255, 255, 255, 0.48);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.72),
    inset 0 3px 6px rgba(255, 255, 255, 0.64),
    inset 0 -3px 5px rgba(121, 75, 29, 0.22),
    0 3px 8px rgba(113, 78, 38, 0.22);
  -webkit-app-region: no-drag;
}

.claim-button:hover {
  border-color: #a87437;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.44) 32%, rgba(255, 255, 255, 0) 50%),
    linear-gradient(180deg, #fffef8 0%, #f6e9ca 38%, #e6c895 68%, #cb965b 100%);
}

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

.pet-column {
  --alcove-top-height: 80px;
  --alcove-bottom-height: 54px;
  --alcove-left-width: 48px;
  --alcove-action-width: 96px;
  position: relative;
  width: 352px;
  height: 300px;
  min-width: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.pet-background-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

.pet-background-slice {
  height: 100%;
  display: block;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
}

.pet-background-row {
  display: flex;
  overflow: hidden;
}

.pet-background-left {
  width: var(--alcove-left-width);
  min-width: var(--alcove-left-width);
  flex: 0 0 var(--alcove-left-width);
}

.pet-background-center {
  width: 0;
  min-width: 0;
  flex: 1 1 0;
}

.pet-background-right {
  width: var(--alcove-action-width);
  flex: 0 0 var(--alcove-action-width);
}

.pet-background-top {
  height: var(--alcove-top-height);
  flex: 0 0 var(--alcove-top-height);
}

.pet-background-middle {
  height: 0;
  min-height: 0;
  flex: 1 1 0;
}

.pet-background-bottom {
  height: var(--alcove-bottom-height);
  flex: 0 0 var(--alcove-bottom-height);
}

.pet-column::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 24px;
  width: 220px;
  height: 16px;
  border-radius: 50%;
  background: rgba(44, 42, 36, 0.16);
  filter: blur(7px);
  transform: translateX(-50%);
  z-index: 1;
}

.window-actions {
  --control-size: 34px;
  --control-gap: 4px;
  --control-clearance: 8px;
  position: absolute;
  top: 0;
  right: 0;
  z-index: 10;
  width: calc(var(--control-size) + var(--control-size) + var(--control-gap));
  height: var(--control-size);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--control-gap);
  -webkit-app-region: no-drag;
}

.preview-exit-button {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
  height: 30px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid #777872;
  border-radius: 20px;
  color: #424541;
  background: rgba(244, 242, 235, 0.92);
  font-size: 11px;
  font-weight: 650;
  box-shadow: 0 2px 5px rgba(35, 36, 33, 0.2);
  -webkit-app-region: no-drag;
}

.preview-exit-button:hover {
  color: #1f5f34;
  border-color: #4b7f55;
  background: #f8f7f2;
}

.preview-exit-button svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

.icon-button {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #555d66;
  background: transparent;
}

.window-actions .icon-button {
  position: relative;
  z-index: 1;
  width: var(--control-size);
  height: var(--control-size);
  border: 1px solid #666762;
  border-radius: 50%;
  color: #535651;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0) 46%),
    #d2d1cb;
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.46),
    0 1px 3px rgba(36, 37, 35, 0.34);
}

.window-actions .icon-button:hover {
  color: #252824;
  background: #e3e2dc;
}

.window-actions .icon-button svg,
.window-actions .icon-button img {
  width: 17px;
  height: 17px;
  display: block;
  stroke-width: 2;
}

.claim-button svg,
.primary-button svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.pet-stage {
  position: relative;
  z-index: 1;
  width: 302px;
  aspect-ratio: 1;
  flex: none;
}

.pet-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.bowl-layer {
  transform: translateY(20px);
}

.history-view {
  position: absolute;
  inset: 20px;
  z-index: 40;
  min-width: 0;
  padding: 12px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  border: 1px solid #85837d;
  border-radius: 9px;
  color: #30322f;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0) 25%),
    #e5e2da;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.5),
    0 4px 14px rgba(39, 40, 37, 0.2);
  overflow: hidden;
  -webkit-app-region: no-drag;
}

.history-view[hidden] {
  display: none;
}

.history-heading {
  min-width: 0;
  display: grid;
  grid-template-columns: 32px auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.history-heading h1 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
}

.history-back-button,
.history-month-picker .icon-button {
  border-color: #aaa9a3;
  color: #434641;
  background: rgba(255, 255, 255, 0.42);
}

.history-month-picker {
  justify-self: end;
  display: grid;
  grid-template-columns: 28px minmax(88px, auto) 28px;
  align-items: center;
  gap: 3px;
}

.history-month-picker .icon-button {
  width: 28px;
  height: 28px;
}

.history-month-picker .icon-button:disabled {
  color: #aaa9a3;
  cursor: default;
  opacity: 0.6;
}

.history-month-picker strong {
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
}

.history-summary {
  min-width: 0;
  margin: 0;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border-top: 1px solid rgba(119, 117, 110, 0.46);
  border-bottom: 1px solid rgba(119, 117, 110, 0.46);
  background: rgba(255, 255, 255, 0.28);
}

.history-summary div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.history-summary dt {
  color: #71736f;
  font-size: 10px;
}

.history-summary dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #242724;
  font-family: "SFMono-Regular", Menlo, Monaco, monospace;
  font-size: 14px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-summary .history-deduction,
.history-detail-deduction dd {
  color: #9f3733;
}

.history-list {
  grid-row: 3;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.history-record {
  padding: 9px 4px 10px;
  display: grid;
  gap: 6px;
  border-bottom: 1px solid rgba(119, 117, 110, 0.32);
}

.history-record:first-child {
  padding-top: 2px;
}

.history-record-main {
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.history-record-date {
  color: #3e413d;
  font-size: 13px;
  font-weight: 650;
}

.history-record-final {
  color: #237a43;
  font-family: "SFMono-Regular", Menlo, Monaco, monospace;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.history-record-details {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.history-record-details div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.history-record-details dt {
  color: #7a7c77;
  font-size: 9px;
}

.history-record-details dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #454844;
  font-family: "SFMono-Regular", Menlo, Monaco, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-empty {
  grid-row: 3;
  min-height: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: #737570;
  font-size: 12px;
}

.history-empty svg {
  width: 28px;
  height: 28px;
  stroke-width: 1.6;
}

dialog {
  width: min(656px, calc(100vw - 12px));
  max-height: calc(100vh - 12px);
  padding: 0;
  border: 1px solid #777872;
  border-radius: 6px;
  color: #292a28;
  background: #e9e7e0;
  box-shadow: 0 24px 60px rgba(24, 26, 25, 0.32), inset 0 0 0 3px rgba(255, 255, 255, 0.46);
  -webkit-app-region: no-drag;
}

dialog::backdrop {
  background: rgba(25, 27, 26, 0.48);
}

#settings-form {
  padding: 16px;
}

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

.dialog-heading h2 {
  margin: 0;
  font-size: 18px;
}

.dialog-heading .icon-button {
  border-color: #a8a9a3;
  color: #424541;
  background: rgba(255, 255, 255, 0.4);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 14px;
}

.form-grid.time-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid label {
  display: grid;
  gap: 4px;
  color: #51534f;
  font-size: 12px;
}

.form-grid input {
  width: 100%;
  height: 34px;
  padding: 0 8px;
  border: 1px solid #a9aaa4;
  border-radius: 5px;
  color: #242623;
  background: #f8f7f3;
  outline: none;
}

.form-grid input:focus {
  border-color: #4d8f57;
  box-shadow: 0 0 0 3px rgba(77, 143, 87, 0.14);
}

.weekday-field {
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

.weekday-field legend {
  margin-bottom: 4px;
  color: #51534f;
  font-size: 12px;
}

.weekday-picker {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.weekday-picker label {
  position: relative;
}

.weekday-picker input {
  position: absolute;
  opacity: 0;
}

.weekday-picker span {
  min-height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid #b0b0aa;
  border-radius: 5px;
  color: #5f625d;
  background: #f6f5f0;
  font-size: 12px;
  cursor: pointer;
}

.weekday-picker input:checked + span {
  border-color: #3f874b;
  color: #27894f;
  background: #e8f2e9;
  box-shadow: inset 0 0 0 1px rgba(63, 135, 75, 0.08);
}

.weekday-picker input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(77, 143, 87, 0.18);
}

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

.summary-field {
  display: grid;
  gap: 4px;
}

.summary-field > span,
.summary-heading > span {
  color: #555a56;
  font-size: 11px;
}

.summary-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.summary-field output,
.summary-field input {
  min-height: 34px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  border: 1px solid #a9aaa4;
  border-radius: 5px;
  color: #242623;
  background: #f8f7f3;
  font-size: 12px;
}

.summary-field input {
  width: 100%;
  outline: none;
}

.summary-field input:focus {
  border-color: #4d8f57;
  box-shadow: 0 0 0 3px rgba(77, 143, 87, 0.14);
}

.rate-summary output {
  color: #26854d;
  font-weight: 700;
}

.compact-switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  color: #858984;
  font-size: 10px;
  cursor: pointer;
}

.compact-switch input {
  position: absolute;
  opacity: 0;
}

.compact-switch i {
  position: relative;
  width: 26px;
  height: 15px;
  border-radius: 15px;
  background: #aeb0ab;
  transition: background 160ms ease;
}

.compact-switch i::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.24);
  transition: transform 160ms ease;
}

.compact-switch input:checked + i {
  background: #27894f;
}

.compact-switch input:checked + i::after {
  transform: translateX(11px);
}

.compact-switch input:focus-visible + i {
  outline: 2px solid #3c78d8;
  outline-offset: 2px;
}

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

.dialog-actions {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
}

.primary-button,
.secondary-button {
  min-height: 34px;
  min-width: 90px;
  padding: 0 14px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 620;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #326f3d;
  color: #fff;
  background: #3f874b;
}

.secondary-button {
  border: 1px solid #a8a9a3;
  color: #41433f;
  background: #f7f6f1;
}

.simulation-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.simulation-actions button {
  padding: 0;
  border: 0;
  color: #27894f;
  background: transparent;
  font-size: 11px;
  font-weight: 650;
}

.simulation-actions button:hover {
  color: #195f35;
  text-decoration: underline;
}

[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  html,
  body {
    min-height: 100%;
  }

  body {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    padding: 0;
    align-items: stretch;
    overflow-x: hidden;
    overflow-y: hidden;
  }

  .app-shell {
    width: 100vw;
    height: 100dvh;
    min-height: 100dvh;
    padding:
      max(20px, env(safe-area-inset-top))
      max(14px, env(safe-area-inset-right))
      max(14px, env(safe-area-inset-bottom))
      max(14px, env(safe-area-inset-left));
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-radius: 0;
  }

  .app-shell::before {
    inset: 8px;
    border-radius: 0;
  }

  .metrics-column {
    display: contents;
  }

  .status-strip {
    order: 1;
    min-height: 42px;
    margin-right: 32px;
    margin-left: 32px;
    padding: 0 10px;
  }

  .status-strip::before {
    left: -28px;
  }

  .status-strip::after {
    right: -28px;
  }

  .status-strip span,
  .rate-strip > span {
    font-size: 12px;
  }

  .status-strip strong,
  .time-strip strong {
    font-size: 13px;
  }

  .rate-strip {
    padding: 0 10px;
  }

  .money-panel {
    order: 3;
    height: clamp(138px, 19dvh, 190px);
    flex: none;
  }

  .rate {
    font-size: 12px;
  }

  .amount-screen {
    padding: 8px 10px 10px;
    gap: 6px;
  }

  .currency-symbol {
    font-size: 24px;
    transform: translateY(5px);
  }

  .amount-screen strong {
    font-size: 46px;
  }

  .amount-screen .amount-visibility-button {
    width: 28px;
    height: 28px;
    transform: translateY(5px);
  }

  .amount-screen .amount-visibility-button img {
    width: 28px;
    height: 28px;
  }

  .pet-column {
    --alcove-top-height: 72px;
    --alcove-bottom-height: 72px;
    --alcove-left-width: 55px;
    --alcove-action-width: 96px;
    order: 2;
    width: 100%;
    height: auto;
    min-height: 220px;
    flex: 1 1 auto;
    aspect-ratio: auto;
  }

  .pet-stage {
    position: absolute;
    left: 50%;
    bottom: 10px;
    width: auto;
    height: min(440px, calc(100% - 20px), 92vw);
    max-width: calc(100% - 12px);
    aspect-ratio: 1;
    transform: translateX(-50%);
  }

  .window-actions {
    top: 8px;
    right: 8px;
  }

  .time-strip {
    order: 4;
    min-height: 44px;
  }

  .claim-button {
    order: 5;
    min-height: 60px;
    padding: 0 20px;
    flex: none;
    gap: 10px;
    border-width: 2px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 700;
    box-shadow:
      inset 0 0 0 2px rgba(255, 255, 255, 0.76),
      inset 0 4px 7px rgba(255, 255, 255, 0.68),
      inset 0 -4px 6px rgba(121, 75, 29, 0.24),
      0 5px 12px rgba(113, 78, 38, 0.3);
  }

  .claim-button svg {
    width: 20px;
    height: 20px;
  }

  .app-shell.history-open {
    width: 100vw;
    height: 100dvh;
    min-height: 100dvh;
  }

  .history-view {
    inset: 14px;
    padding: 10px;
    gap: 10px;
    border-radius: 7px;
  }

  .history-heading {
    grid-template-columns: 32px auto minmax(0, 1fr);
    gap: 6px;
  }

  .history-heading h1 {
    font-size: 16px;
  }

  .history-summary {
    padding: 10px 6px;
    gap: 5px;
  }

  .history-summary dd {
    font-size: 12px;
  }

  .history-record {
    padding: 11px 2px 12px;
  }

  .history-record-details {
    gap: 6px;
  }

  dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }

  #settings-form {
    padding: 14px;
  }

  .weekday-picker {
    gap: 6px;
  }

  .form-grid,
  .form-grid.time-grid,
  .summary-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .dialog-footer {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .dialog-actions {
    order: 2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .simulation-actions {
    order: 1;
    justify-content: flex-end;
    gap: 14px;
  }
}

@media (orientation: portrait) and (max-width: 340px) {
  .window-actions {
    --control-size: 30px;
    --control-gap: 3px;
    top: 8px;
    right: 4px;
  }

  .window-actions .icon-button img {
    width: 15px;
    height: 15px;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  html,
  body {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
  }

  body {
    padding: 0;
    overflow: hidden;
  }

  .app-shell,
  .app-shell.history-open {
    width: 100vw;
    height: 100dvh;
    min-height: 100dvh;
    padding:
      max(12px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(12px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
    display: grid;
    grid-template-columns: minmax(260px, 40%) minmax(0, 1fr);
    gap: 8px;
    border-radius: 0;
  }

  .app-shell::before {
    inset: 7px;
    border-radius: 0;
  }

  .metrics-column {
    display: grid;
  }

  .pet-column {
    order: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .pet-stage {
    position: absolute;
    left: 50%;
    bottom: 10px;
    width: auto;
    height: min(318px, calc(100% - 20px));
    max-width: calc(100% - 16px);
    transform: translateX(-50%);
  }

  .window-actions {
    top: 8px;
    right: 8px;
  }

  .claim-button {
    min-height: 52px;
    border-radius: 26px;
    font-size: 16px;
  }

  .history-view {
    inset: 12px;
  }
}
