/* Final visual polish layer; loaded after base HUD styles. */
.rule-rune > svg {
  width: 15px;
  height: 15px;
  transform: rotate(-45deg);
}

.rule-copy {
  min-width: 0;
}

.rule-copy h3 {
  margin: 0;
  color: var(--time-text-strong, #fff0c7);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.22;
}

.rule-copy p {
  margin: 4px 0 0;
  color: var(--time-muted, #a6977b);
  font-size: 13px;
  line-height: 1.25;
}

.rule-row-meta {
  min-width: 50px;
  display: grid;
  justify-items: end;
  gap: 5px;
  color: var(--time-muted, #a6977b);
  font-size: 12px;
}

.rule-reward {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  color: var(--time-text, #d8ccb0);
  white-space: nowrap;
}

.reward-currency-icon {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  color: var(--time-accent, #c9953c);
  filter: drop-shadow(0 1px 0 #000) drop-shadow(0 0 3px var(--time-glow, transparent));
}

.rule-progress-pips {
  display: flex;
  gap: 5px;
}

.rule-progress-pips i {
  width: 6px;
  height: 6px;
  display: block;
  border: 1px solid color-mix(in srgb, var(--time-line, #98815a) 72%, transparent);
  transform: rotate(45deg);
}

.rule-progress-pips i.filled {
  background: var(--time-accent, #d8c996);
  box-shadow: 0 0 5px var(--time-glow, transparent);
}

.rule-status-glyph {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--time-muted, #a6977b);
  font-size: 19px;
  text-shadow: 0 1px 0 #000;
}

.intervention-row[data-status="success"] .rule-status-glyph {
  color: var(--time-accent, #d8c996);
}

.intervention-row[data-status="day_off"] .rule-status-glyph,
.intervention-row[data-status="exception"] .rule-status-glyph {
  color: var(--time-text, #d8ccb0);
}

.intervention-row[data-status="violation"] .rule-status-glyph {
  color: #b86666;
}

.history-view {
  grid-template-rows: auto minmax(0, 1fr);
}

.history-header {
  min-height: 66px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 8px;
  position: relative;
  z-index: 1;
}

.history-header .interventions-heading span {
  display: block;
  margin-top: 3px;
  color: var(--time-muted, #a6977b);
  font-size: 14px;
  line-height: 1.2;
}

.history-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 16px 22px;
  position: relative;
  z-index: 1;
}

.history-calendar-panel {
  border-style: solid;
  border-width: 1px 0;
  border-image-source: linear-gradient(90deg, transparent, color-mix(in srgb, var(--time-divider, #9c8458) 72%, transparent) 18%, color-mix(in srgb, var(--time-divider, #9c8458) 72%, transparent) 82%, transparent);
  border-image-slice: 1;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--time-panel-deep, #090909) 54%, transparent) 10%, color-mix(in srgb, var(--time-panel-deep, #090909) 54%, transparent) 90%, transparent);
}

.history-month-nav {
  min-height: 48px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  align-items: center;
}

.history-month-nav button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--time-muted, #a6977b);
  border: 0;
  background: transparent;
  box-shadow: none;
}

.history-month-nav button:active {
  transform: none;
  color: var(--time-text-strong, #fff0c7);
}

.history-month-nav svg {
  width: 18px;
  height: 18px;
}

.history-month-nav time {
  color: var(--time-text-strong, #fff0c7);
  text-align: center;
  font-family: var(--font-display);
  font-size: 16px;
}

.history-weekdays,
.history-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.history-weekdays {
  min-height: 24px;
  align-items: center;
  color: var(--time-muted, #a6977b);
  text-align: center;
  font-size: 12px;
}

.history-calendar {
  padding: 2px 0 9px;
}

.history-day {
  min-width: 0;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  padding: 0;
  position: relative;
  color: var(--time-text, #d8ccb0);
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 14px;
}

.history-day:active {
  transform: none;
}

.history-day.outside-month {
  opacity: 0.2;
}

.history-day.future {
  opacity: 0.28;
}

.history-day.today::before,
.history-day.selected::before {
  content: "";
  position: absolute;
  inset: 18%;
  border: 1px solid color-mix(in srgb, var(--time-line, #98815a) 58%, transparent);
  transform: rotate(45deg);
}

.history-day.selected::before {
  border-color: var(--time-accent, #d8c996);
  background: color-mix(in srgb, var(--time-accent, #c88b3a) 11%, transparent);
  box-shadow: inset 0 0 8px var(--time-glow, transparent);
}

.history-day > span,
.history-day > i {
  position: relative;
  z-index: 1;
}

.history-day > i {
  width: 4px;
  height: 4px;
  display: block;
  border-radius: 50%;
  background: transparent;
}

.history-day.has-success > i {
  background: var(--time-accent, #d8c996);
  box-shadow: 0 0 5px var(--time-glow, transparent);
}

.history-day.has-rest > i {
  background: var(--time-muted, #a6977b);
}

.history-day.has-violation > i {
  background: #b86666;
  box-shadow: 0 0 5px rgba(184, 60, 68, 0.28);
}

.history-detail {
  margin-top: 16px;
}

.history-detail > header {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 3px 7px;
  border-bottom: 1px solid transparent;
  border-image-source: linear-gradient(90deg, transparent, color-mix(in srgb, var(--time-divider, #9c8458) 58%, transparent) 12%, color-mix(in srgb, var(--time-divider, #9c8458) 58%, transparent) 88%, transparent);
  border-image-slice: 1;
}

.history-detail h2 {
  margin: 0;
  color: var(--time-text-strong, #fff0c7);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 400;
}

.history-detail header span {
  color: var(--time-muted, #a6977b);
  font-size: 12px;
}

.history-day-entries {
  display: grid;
}

.history-entry,
.history-empty {
  min-height: 48px;
  display: grid;
  align-items: center;
  border-bottom: 1px solid transparent;
  border-image-source: linear-gradient(90deg, transparent, color-mix(in srgb, var(--time-line, #98815a) 36%, transparent) 12%, color-mix(in srgb, var(--time-line, #98815a) 36%, transparent) 88%, transparent);
  border-image-slice: 1;
}

.history-entry {
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 9px;
  padding: 7px 3px;
}

.history-entry.primary-project {
  margin: 5px 0 7px;
  padding: 9px 7px;
  border: 1px solid color-mix(in srgb, var(--time-accent, #c88b3a) 52%, transparent);
  border-image: none;
  background: color-mix(in srgb, var(--time-accent, #c88b3a) 7%, var(--time-panel-deep, #090909));
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--time-line, #98815a) 10%, transparent);
}

.history-entry svg {
  width: 16px;
  height: 16px;
  color: var(--time-accent, #d8c996);
}

.history-entry div {
  min-width: 0;
}

.history-entry strong {
  display: block;
  color: var(--time-text, #d8ccb0);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 400;
}

.history-entry small,
.history-empty {
  color: var(--time-muted, #a6977b);
  font-size: 12px;
}

.history-entry-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}

.history-entry-state {
  display: grid;
  justify-items: end;
  gap: 3px;
  min-width: 72px;
  text-align: right;
}

.history-entry-state > span {
  color: var(--time-muted, #a6977b);
  font-size: 13px;
  white-space: nowrap;
}

.history-entry-measure {
  color: color-mix(in srgb, var(--time-muted, #a6977b) 74%, transparent);
  font-size: 11px;
  font-weight: 400;
  white-space: nowrap;
}

.history-entry[data-status="success"] .history-entry-state > span {
  color: var(--time-accent, #d8c996);
}

.history-entry[data-status="violation"] .history-entry-state > span {
  color: #b86666;
}

.history-entry[data-status="unmarked"],
.history-entry[data-status="not_required"] {
  opacity: 0.48;
}

.history-entry[data-status="not_required"] .history-entry-state > span {
  color: var(--time-muted, #a6977b);
  font-size: 12px;
}

.history-empty {
  place-items: center;
  min-height: 82px;
}

.checkin-layer {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  align-items: end;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.78));
}

.checkin-sheet {
  width: 100%;
  max-height: min(78dvh, 650px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  position: relative;
  overflow: hidden;
  color: var(--time-text, #d8ccb0);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--time-accent, #c88b3a) 10%, transparent), transparent 34%),
    color-mix(in srgb, var(--time-panel-deep, #090909) 97%, #16130f);
  box-shadow: 0 -16px 34px rgba(0, 0, 0, 0.74);
}

.checkin-sheet::before {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--time-divider, #9c8458) 22%, var(--time-divider, #9c8458) 78%, transparent);
}

.checkin-header {
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 10px;
}

.checkin-header > div {
  min-width: 0;
}

.checkin-sphere {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--time-accent, #d8c996);
  font-size: 13px;
  font-variant-caps: small-caps;
}

.checkin-sphere-icon {
  width: 14px;
  height: 14px;
  filter: drop-shadow(0 1px 0 #000) drop-shadow(0 0 4px var(--time-glow, transparent));
}

.checkin-header h2 {
  margin: 4px 0 0;
  color: var(--time-text-strong, #fff0c7);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 400;
  line-height: 1.2;
}

.checkin-body {
  min-height: 0;
  overflow-y: auto;
  padding: 0 16px 12px;
}

.checkin-description {
  margin: 0 0 12px;
  color: var(--time-muted, #a6977b);
  font-size: 14px;
  line-height: 1.45;
}

.checkin-voluntary-note {
  margin: -3px 0 12px;
  padding: 8px 11px;
  color: var(--time-text, #d8ccb0);
  border-style: solid;
  border-width: 1px 0;
  border-image-source: linear-gradient(90deg, transparent, color-mix(in srgb, var(--time-line, #98815a) 58%, transparent) 16%, color-mix(in srgb, var(--time-line, #98815a) 58%, transparent) 84%, transparent);
  border-image-slice: 1;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--time-panel-deep, #090909) 64%, transparent) 12%, color-mix(in srgb, var(--time-panel-deep, #090909) 64%, transparent) 88%, transparent);
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
}

.checkin-state-line {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-style: solid;
  border-width: 1px 0;
  border-image-source: linear-gradient(90deg, transparent, color-mix(in srgb, var(--time-line, #98815a) 54%, transparent) 14%, color-mix(in srgb, var(--time-line, #98815a) 54%, transparent) 86%, transparent);
  border-image-slice: 1;
}

.checkin-state-line span,
.metric-control > span:first-child {
  color: var(--time-muted, #a6977b);
  font-size: 14px;
}

.checkin-state-line strong {
  color: var(--time-text-strong, #fff0c7);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 400;
}

.checkin-state-value {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  position: relative;
}

.metric-control {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
}

.metric-control[hidden] {
  display: none;
}

.metric-stepper {
  display: grid;
  grid-template-columns: 34px 64px 34px;
  border: 1px solid color-mix(in srgb, var(--time-line, #98815a) 62%, transparent);
  background: color-mix(in srgb, var(--time-panel-deep, #090909) 72%, transparent);
}

.metric-stepper button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--time-text, #d8ccb0);
  border: 0;
  background: transparent;
  box-shadow: none;
}

.metric-stepper button:active {
  transform: none;
  background: color-mix(in srgb, var(--time-accent, #c88b3a) 12%, transparent);
}

.metric-stepper svg {
  width: 15px;
  height: 15px;
}

.metric-stepper input {
  width: 64px;
  min-width: 0;
  padding: 0 4px;
  color: var(--time-text-strong, #fff0c7);
  border: 0;
  border-inline: 1px solid color-mix(in srgb, var(--time-line, #98815a) 45%, transparent);
  outline: 0;
  background: transparent;
  text-align: center;
  font-family: var(--font-display);
  font-size: 16px;
  appearance: textfield;
}

.metric-stepper input::-webkit-inner-spin-button,
.metric-stepper input::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}

.weekdays-control {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid transparent;
  border-image-source: linear-gradient(90deg, transparent, color-mix(in srgb, var(--time-line, #98815a) 46%, transparent) 16%, color-mix(in srgb, var(--time-line, #98815a) 46%, transparent) 84%, transparent);
  border-image-slice: 1;
}

.weekdays-control[hidden] {
  display: none;
}

.weekdays-control header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.weekdays-control header span {
  color: var(--time-text, #d8ccb0);
  font-family: var(--font-display);
  font-size: 14px;
}

.weekdays-control header small {
  color: var(--time-muted, #a6977b);
  font-size: 12px;
}

.weekday-buttons {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin-top: 9px;
}

.weekday-buttons button {
  min-width: 0;
  height: 40px;
  padding: 0;
  position: relative;
  color: var(--time-muted, #a6977b);
  border: 1px solid color-mix(in srgb, var(--time-line, #98815a) 42%, transparent);
  background: color-mix(in srgb, var(--time-panel-deep, #090909) 68%, transparent);
  box-shadow: none;
  font-size: 12px;
}

.weekday-buttons button:active {
  transform: none;
}

.weekday-buttons button.active {
  color: var(--time-text-strong, #fff0c7);
  border-color: var(--time-accent, #d8c996);
  background: color-mix(in srgb, var(--time-accent, #c88b3a) 18%, transparent);
  box-shadow: inset 0 0 9px var(--time-glow, transparent);
}

.weekday-buttons button.selected {
  border-color: var(--time-text-strong, #fff0c7);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--time-accent, #d8c996) 54%, transparent), inset 0 0 9px var(--time-glow, transparent);
}

.weekday-buttons button.rest {
  color: var(--time-text, #d8ccb0);
  background: color-mix(in srgb, var(--time-muted, #a6977b) 14%, transparent);
}

.weekday-buttons button.violation {
  color: #ffd2d2;
  border-color: #b86666;
  background: rgba(105, 27, 34, 0.4);
}

.weekday-buttons button.today::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 3px;
  height: 3px;
  background: currentColor;
  transform: translateX(-50%) rotate(45deg);
}

.weekday-buttons button:disabled {
  opacity: 0.25;
}

.weekday-inspection {
  min-height: 36px;
  display: flex;
  align-items: center;
  margin-top: 9px;
  padding: 9px 2px 0;
  border-top: 1px solid transparent;
  border-image-source: linear-gradient(90deg, transparent, color-mix(in srgb, var(--time-line, #98815a) 38%, transparent) 16%, color-mix(in srgb, var(--time-line, #98815a) 38%, transparent) 84%, transparent);
  border-image-slice: 1;
}

.weekday-inspection time {
  color: var(--time-muted, #a6977b);
  font-size: 12px;
}

.checkin-actions {
  display: grid;
  gap: 8px;
  padding: 10px 16px max(14px, var(--app-safe-bottom));
  background: linear-gradient(0deg, color-mix(in srgb, var(--time-panel-deep, #090909) 98%, #050505), transparent);
}

.checkin-status-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.checkin-status-actions[hidden] {
  display: none;
}

.checkin-status-actions.limit-mode {
  grid-template-columns: minmax(0, 150px);
  justify-content: center;
}

.checkin-status-actions.extra-mode {
  grid-template-columns: minmax(0, 220px);
  justify-content: center;
}

.checkin-status-actions.no-rest:not(.limit-mode) {
  grid-template-columns: repeat(2, minmax(0, 150px));
  justify-content: center;
}

.checkin-status-actions.extra-mode.no-rest:not(.limit-mode) {
  grid-template-columns: minmax(0, 220px);
}

.checkin-status-actions button {
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 4px;
  color: var(--time-muted, #a6977b);
  border: 1px solid color-mix(in srgb, var(--time-line, #98815a) 42%, transparent);
  background: color-mix(in srgb, var(--time-panel-deep, #090909) 68%, transparent);
  box-shadow: none;
  font-size: 13px;
  line-height: 1.15;
}

.checkin-status-actions button[hidden] {
  display: none;
}

.checkin-status-actions button:active {
  transform: none;
}

.checkin-status-actions button.active {
  color: var(--time-text-strong, #fff0c7);
  border-color: var(--time-accent, #d8c996);
  background: color-mix(in srgb, var(--time-accent, #c88b3a) 18%, transparent);
  box-shadow: inset 0 0 12px var(--time-glow, transparent);
}

.checkin-status-actions .danger-action {
  color: #c98787;
  border-color: rgba(137, 52, 59, 0.58);
}

.checkin-status-actions .danger-action.active {
  color: #ffd2d2;
  border-color: #b86666;
  background: rgba(105, 27, 34, 0.46);
  box-shadow: inset 0 0 12px rgba(184, 60, 68, 0.2);
}

.confirm-checkin {
  min-height: 48px;
  color: var(--time-text-strong, #fff0c7);
  border-style: solid;
  border-width: 1px 0;
  border-image-source: linear-gradient(90deg, transparent, var(--time-divider, #9c8458) 22%, var(--time-divider, #9c8458) 78%, transparent);
  border-image-slice: 1;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--time-accent, #c88b3a) 22%, transparent) 24%, color-mix(in srgb, var(--time-accent, #c88b3a) 22%, transparent) 76%, transparent);
  box-shadow: none;
}

.confirm-checkin:active {
  transform: translateY(1px);
}

.confirm-checkin:disabled {
  color: var(--time-muted, #a6977b);
  border-image-source: linear-gradient(90deg, transparent, color-mix(in srgb, var(--time-line, #98815a) 30%, transparent) 24%, color-mix(in srgb, var(--time-line, #98815a) 30%, transparent) 76%, transparent);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--time-panel-deep, #090909) 44%, transparent) 24%, color-mix(in srgb, var(--time-panel-deep, #090909) 44%, transparent) 76%, transparent);
  opacity: 0.55;
}

.checkin-success {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--time-text-strong, #fff0c7);
  border-style: solid;
  border-width: 1px 0;
  border-image-source: linear-gradient(90deg, transparent, var(--time-divider, #9c8458) 22%, var(--time-divider, #9c8458) 78%, transparent);
  border-image-slice: 1;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--time-accent, #c88b3a) 20%, transparent) 24%, color-mix(in srgb, var(--time-accent, #c88b3a) 20%, transparent) 76%, transparent);
  box-shadow: none;
}

.checkin-success:active {
  transform: translateY(1px);
  box-shadow: none;
}

.checkin-secondary-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 6px;
}

.checkin-secondary-actions button {
  min-height: 38px;
  padding: 5px;
  color: var(--time-text, #d8ccb0);
  border: 1px solid color-mix(in srgb, var(--time-line, #98815a) 42%, transparent);
  background: color-mix(in srgb, var(--time-panel-deep, #090909) 68%, transparent);
  box-shadow: none;
  font-size: 13px;
}

.checkin-secondary-actions button:active {
  transform: none;
  background: color-mix(in srgb, var(--time-accent, #c88b3a) 12%, transparent);
}

.checkin-secondary-actions .danger-action {
  color: #c98787;
  border-color: rgba(137, 52, 59, 0.58);
}

.clear-checkin {
  justify-self: center;
  padding: 5px 12px;
  color: var(--time-muted, #a6977b);
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 13px;
}

.clear-checkin:active {
  transform: none;
  color: var(--time-text, #d8ccb0);
}

.app-shell.interventions-open .time-switcher,
.app-shell.history-open .time-switcher {
  display: none;
}

.app-shell.interventions-open .topbar,
.app-shell.interventions-open .bottom-nav,
.app-shell.history-open .topbar,
.app-shell.history-open .bottom-nav {
  visibility: hidden;
  pointer-events: none;
}

.app-shell.interventions-open .interventions-view,
.app-shell.history-open .history-view {
  grid-row: 1 / -1;
  z-index: 45;
}

.app-shell.interventions-open .checkin-layer,
.app-shell.history-open .checkin-layer {
  z-index: 60;
}

.app-shell.interventions-open .avatar-layer,
.app-shell.interventions-open .attribute-rig,
.app-shell.history-open .avatar-layer,
.app-shell.history-open .attribute-rig {
  opacity: 0.12;
}

.interventions-header {
  padding-right: 58px;
}

.interventions-close {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  position: absolute;
  top: max(10px, var(--app-safe-top));
  right: 10px;
  z-index: 4;
  padding: 0;
  color: var(--time-muted, #a6977b);
  border: 0;
  background: transparent;
  box-shadow: none;
}

.interventions-close svg {
  width: 20px;
  height: 20px;
  filter: drop-shadow(0 1px 0 #000);
}

.interventions-close:active {
  transform: translateY(1px);
}

@media (max-width: 400px) {
  .interventions-header .daily-tally {
    display: none;
  }

  .interventions-heading {
    width: min(calc(100% - 104px), 244px);
  }
}

.aura {
  position: absolute;
  width: min(68%, 300px);
  aspect-ratio: 1;
  border-radius: 0;
  background:
    radial-gradient(circle, rgba(95, 91, 156, 0.2) 0 30%, transparent 31%),
    radial-gradient(circle, rgba(200, 139, 58, 0.16) 0 52%, transparent 53%);
  filter: blur(1px);
  z-index: 1;
}

.stone-wall {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 44px 24px,
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 44px 24px,
    linear-gradient(180deg, #171620, #0d0d13);
  opacity: 0.92;
}

.candles {
  position: absolute;
  inset: auto 22px 24px 22px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.candles span {
  width: 16px;
  height: 42px;
  background:
    linear-gradient(#f1b24a 0 9px, transparent 10px),
    linear-gradient(90deg, #d8caa0 0 11px, #7d5b37 12px 16px);
  box-shadow: 0 0 18px rgba(241, 178, 74, 0.38);
}

.bottom-nav {
  grid-row: 3;
  grid-column: 1;
  gap: 8px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: 48px 54px;
  min-height: 144px;
  height: 100%;
  margin-top: 0;
  padding:
    30px
    max(12px, var(--app-safe-right))
    max(12px, var(--app-safe-bottom))
    max(12px, var(--app-safe-left));
  align-items: end;
  position: relative;
  background: transparent;
  border: 0;
  box-shadow: none;
  z-index: 10;
}

.bottom-nav::before {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  top: 18px;
  height: var(--ui-line-thickness);
  background: linear-gradient(90deg, transparent 0, var(--time-divider, rgba(190, 169, 123, 0.62)) 24%, var(--time-divider, rgba(190, 169, 123, 0.62)) 76%, transparent 100%);
  filter: none;
  transform: none;
  pointer-events: none;
  display: none;
}

.tab,
.primary-action,
.secondary-action {
  padding: 10px 12px;
}

.tab {
  min-height: 54px;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 7px 6px;
  position: relative;
}

.bottom-nav .tab {
  width: 100%;
  height: 58px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: color-mix(in srgb, var(--time-text, #f0e6c8) 82%, transparent);
  text-shadow: 0 2px 0 #000;
  font-family: var(--font-display);
}

.bottom-nav .tab-featured {
  grid-column: 1 / -1;
  width: 100%;
  height: 48px;
  min-height: 48px;
  display: grid;
  place-items: center;
  color: var(--time-text-strong, #f0e6c8);
  border: 0;
  background:
    linear-gradient(90deg, transparent, color-mix(in srgb, var(--time-accent, #c88b3a) 14%, transparent) 24%, color-mix(in srgb, var(--time-accent, #c88b3a) 14%, transparent) 76%, transparent),
    color-mix(in srgb, var(--time-panel-deep, #07080b) 72%, transparent);
  box-shadow: none;
}

.bottom-nav .tab-featured.active {
  color: var(--time-text-strong, #f0e6c8);
  background:
    linear-gradient(90deg, transparent, color-mix(in srgb, var(--time-accent, #c88b3a) 24%, transparent) 24%, color-mix(in srgb, var(--time-accent, #c88b3a) 24%, transparent) 76%, transparent),
    color-mix(in srgb, var(--time-panel-deep, #07080b) 78%, transparent);
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  filter: drop-shadow(0 2px 0 #000) drop-shadow(0 0 5px var(--time-glow, transparent));
}

.tab-featured .nav-icon {
  width: 23px;
  height: 23px;
}

.nav-back-icon,
.nav-back-label {
  display: none;
}

.nav-interventions-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.nav-interventions-icon {
  position: absolute;
  left: calc(50% - 87px);
}

.app-shell.interventions-open .nav-interventions-icon,
.app-shell.interventions-open .nav-interventions-label,
.app-shell.history-open .nav-interventions-icon,
.app-shell.history-open .nav-interventions-label {
  display: none;
}

.app-shell.interventions-open .nav-back-icon,
.app-shell.interventions-open .nav-back-label,
.app-shell.history-open .nav-back-icon,
.app-shell.history-open .nav-back-label {
  display: block;
}

.app-shell.interventions-open .tab-featured,
.app-shell.history-open .tab-featured {
  display: grid;
  place-items: center;
}

.app-shell.interventions-open .nav-back-label,
.app-shell.history-open .nav-back-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.app-shell.interventions-open .nav-back-icon,
.app-shell.history-open .nav-back-icon {
  position: absolute;
  left: calc(50% - 58px);
}

.bottom-nav .tab::before {
  content: "";
  position: absolute;
  left: 30%;
  right: 30%;
  top: 2px;
  height: var(--ui-line-thickness);
  background: transparent;
}

.bottom-nav .tab:active {
  box-shadow: none;
  opacity: 0.82;
  transform: translateY(1px);
}

.topbar .hud-button:active,
.player-identity:active,
.level-progress:active,
.time-switcher button:active {
  opacity: 0.82;
  transform: translateY(1px);
}

.tab span {
  font-size: 22px;
}

.tab small {
  font-size: 14px;
  color: inherit;
  font-variant-caps: small-caps;
}

.primary-action {
  background: linear-gradient(180deg, color-mix(in srgb, var(--time-accent, #c88b3a) 28%, #29241d) 0, color-mix(in srgb, var(--time-panel-deep, #242015) 82%, #242015) 44%, var(--time-panel-deep, #0d0e0e) 100%);
  color: var(--time-text-strong, #efd596);
  border-color: var(--time-line, #8c7141);
  font-weight: 400;
}

.bottom-nav .tab.active {
  border: 0;
  background: rgba(7, 8, 12, 0.3);
  box-shadow: none;
  color: var(--time-accent, #d8b46f);
  font-weight: 400;
}

.bottom-nav .tab.active::before {
  background: var(--time-accent, #d8b46f);
  box-shadow: 0 0 10px color-mix(in srgb, var(--time-accent, #d8b46f) 72%, transparent);
}

.bottom-nav .tab-featured,
.bottom-nav .tab-featured.active {
  border-style: solid;
  border-width: 1px 0;
  border-image-source: linear-gradient(90deg, transparent 0, var(--time-divider, rgba(190, 169, 123, 0.62)) 24%, var(--time-divider, rgba(190, 169, 123, 0.62)) 76%, transparent 100%);
  border-image-slice: 1;
  background:
    linear-gradient(90deg, transparent, color-mix(in srgb, var(--time-accent, #c88b3a) 18%, transparent) 24%, color-mix(in srgb, var(--time-accent, #c88b3a) 18%, transparent) 76%, transparent),
    color-mix(in srgb, var(--time-panel-deep, #07080b) 74%, transparent);
  box-shadow: none;
}

.bottom-nav .tab-featured::before,
.bottom-nav .tab-featured.active::before,
.bottom-nav .tab-featured::after {
  content: none;
}

.bottom-nav .tab-featured::before,
.bottom-nav .tab-featured.active::before {
  top: 0;
}

.bottom-nav .tab-featured::after {
  bottom: 0;
}

.panel {
  display: none;
  gap: 10px;
}

.panel.active {
  display: grid;
}

.window-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  align-items: end;
  justify-items: center;
  padding: 18px 14px 96px;
  background:
    radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--time-accent, #c88b3a) 10%, transparent), transparent 18rem),
    rgba(0, 0, 0, 0.52);
}

.window-layer[hidden] {
  display: none;
}

.game-window {
  width: min(100%, 520px);
  max-height: min(70dvh, 560px);
  display: grid;
  grid-template-rows: auto 1fr;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--time-accent, #5f5b9c) 12%, transparent), transparent 36%),
    color-mix(in srgb, var(--time-panel-deep, #121015) 96%, #161219);
  overflow: hidden;
}

.window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 10px;
  border-bottom: var(--ui-line-thickness) solid var(--line);
}

.window-heading {
  min-width: 0;
}

.window-kicker {
  display: none;
}

.window-header h2 {
  font-size: 20px;
}

.close-button {
  width: 44px;
  height: 44px;
}

.window-body {
  min-height: 0;
  overflow-y: auto;
  overflow-anchor: none;
  padding: 12px;
}

.row-card,
.friend-card,
.empty-state {
  border: 1px solid color-mix(in srgb, var(--time-line, #937b4e) 72%, transparent);
  border-radius: 0;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--time-accent, #c88b3a) 8%, transparent), transparent 46%),
    color-mix(in srgb, var(--time-panel-deep, #1c181d) 88%, #241b24);
  box-shadow: inset 0 1px 0 rgba(255, 238, 190, 0.06), 0 3px 0 #050507;
}

.row-card {
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
}

.row-card > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.row-card button {
  flex: 0 0 auto;
}

.shop-catalog {
  display: grid;
  gap: 8px;
}

.shop-progression-item {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--time-line, #937b4e) 58%, transparent);
  border-radius: 2px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--time-accent, #c88b3a) 8%, transparent), transparent 46%),
    color-mix(in srgb, var(--time-panel-deep, #1c181d) 88%, #241b24);
}

.shop-progression-item.locked {
  filter: saturate(0.42);
  opacity: 0.66;
}

.shop-progression-item.owned {
  border-color: color-mix(in srgb, var(--time-accent, #c88b3a) 62%, transparent);
}

.shop-progression-item header,
.shop-progression-item footer,
.shop-progression-item header > div {
  min-width: 0;
  display: flex;
  align-items: center;
}

.shop-progression-item header,
.shop-progression-item footer {
  justify-content: space-between;
  gap: 10px;
}

.shop-progression-item header > div {
  gap: 9px;
}

.shop-sphere-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  color: var(--time-accent, #c88b3a);
  border: 1px solid color-mix(in srgb, var(--time-line, #937b4e) 56%, transparent);
}

.shop-progression-item header > div > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.shop-progression-item h2 {
  overflow-wrap: anywhere;
  color: var(--time-text-strong, #f0e6c8);
  font-size: 16px;
  font-weight: 400;
}

.shop-progression-item small,
.shop-unlock-requirement {
  color: var(--time-muted, #9d8f78);
  font-size: 12px;
}

.shop-unlock-requirement {
  flex: 0 0 auto;
  text-align: right;
}

.shop-item-price {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--time-text-strong, #f0e6c8);
  font-size: 15px;
}

.shop-progression-item .primary-action {
  min-width: 100px;
  min-height: 34px;
}

.secondary-action {
  color: var(--time-text, #cbbf9f);
  background: linear-gradient(180deg, color-mix(in srgb, var(--time-accent, #292a2b) 10%, #292a2b) 0, color-mix(in srgb, var(--time-panel-deep, #121316) 90%, #121316) 52%, var(--time-panel-deep, #08090b) 100%);
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.inventory-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: var(--ui-line-thickness) solid var(--line);
  border-radius: 0;
  background: rgba(32, 35, 34, 0.82);
  box-shadow: 5px 5px 0 #050507;
}

.inventory-card button {
  width: 100%;
}

.empty-state {
  padding: 14px;
}

.friend-card {
  gap: 12px;
  padding: 12px;
}

.friend-avatar {
  width: 64px;
  aspect-ratio: 1;
  border-radius: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 37px;
}

.friend-actions {
  gap: 8px;
  flex-wrap: wrap;
}

.window-layer.immersive-window-open {
  align-items: stretch;
  justify-items: stretch;
  padding: 0;
  background: rgba(0, 0, 0, 0.86);
  backdrop-filter: brightness(0.42) saturate(0.62);
}

.immersive-window-open .game-window {
  width: 100%;
  height: 100dvh;
  max-height: none;
  position: relative;
  border: 0;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--time-accent, #c88b3a) 13%, transparent), transparent 26%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018), transparent 22%, transparent 78%, rgba(255, 255, 255, 0.018)),
    color-mix(in srgb, var(--time-panel-deep, #100b0c) 96%, #190f10);
  box-shadow:
    0 -16px 46px rgba(0, 0, 0, 0.52),
    inset 0 1px 0 rgba(255, 238, 194, 0.07);
}

.immersive-window-open .window-header {
  min-height: 62px;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
  justify-items: center;
  place-items: center;
  padding: max(9px, var(--app-safe-top)) 52px 8px;
  border-bottom: 1px solid transparent;
  border-image-source: linear-gradient(90deg, transparent, color-mix(in srgb, var(--time-line, #8f7046) 58%, transparent) 15%, color-mix(in srgb, var(--time-line, #8f7046) 58%, transparent) 85%, transparent);
  border-image-slice: 1;
}

.immersive-window-open .window-heading {
  display: grid;
  justify-items: center;
  gap: 1px;
  text-align: center;
}

.immersive-window-open .window-kicker {
  display: block;
  color: var(--time-accent, #c88b3a);
  font-size: 12px;
  font-variant-caps: small-caps;
}

.immersive-window-open .window-header h2 {
  color: var(--time-text-strong, #f0e6c8);
  font-size: 22px;
  font-weight: 400;
}

.immersive-window-open .close-button {
  width: 36px;
  height: 36px;
  position: absolute;
  right: 10px;
  top: max(13px, var(--app-safe-top));
  color: var(--time-muted, #9d8f78);
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 26px;
}

.immersive-window-open .window-body {
  padding: 0 16px max(12px, var(--app-safe-bottom));
  scrollbar-gutter: stable both-edges;
}

.immersive-window-open #shopPanel.active,
.immersive-window-open #inventoryPanel.active,
.immersive-window-open #friendPanel.active {
  width: 100%;
  max-width: 720px;
  align-content: start;
  gap: 0;
  margin: 0 auto;
}

.collection-overview {
  min-height: 112px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  position: relative;
}

.collection-overview::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--time-line, #655846) 54%, transparent) 10%,
    color-mix(in srgb, var(--time-line, #655846) 54%, transparent) 90%,
    transparent
  );
}

/* The main intervention carries one living accent across every ledger view. */
@property --project-orbit-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

:is(
  .intervention-row.primary-project,
  .history-entry.primary-project,
  #weekly-summaryPanel .weekly-summary-rule.primary-project,
  #statsPanel .intervention-stat-row.primary-project
) {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(
      ellipse at 50% 0,
      color-mix(in srgb, var(--time-accent) 15%, transparent),
      transparent 66%
    ),
    linear-gradient(
      90deg,
      transparent,
      color-mix(in srgb, var(--time-accent) 10%, transparent) 14%,
      color-mix(in srgb, var(--time-accent) 10%, transparent) 86%,
      transparent
    );
  box-shadow:
    inset 0 0 22px color-mix(in srgb, var(--time-accent) 7%, transparent),
    0 0 12px color-mix(in srgb, var(--time-glow) 9%, transparent);
}

:is(
  .intervention-row.primary-project,
  .history-entry.primary-project,
  #weekly-summaryPanel .weekly-summary-rule.primary-project,
  #statsPanel .intervention-stat-row.primary-project
)::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  width: auto;
  height: auto;
  padding: 1.7px;
  pointer-events: none;
  background:
    conic-gradient(
      from var(--project-orbit-angle),
      transparent 0deg 238deg,
      color-mix(in srgb, var(--time-accent) 22%, transparent) 258deg,
      color-mix(in srgb, var(--time-accent) 78%, var(--time-text)) 302deg,
      var(--time-text-strong) 326deg,
      color-mix(in srgb, var(--time-accent) 68%, transparent) 346deg,
      transparent 360deg
    );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  filter:
    drop-shadow(
      0 0 3px color-mix(in srgb, var(--time-glow) 46%, transparent)
    );
  animation: main-project-border-orbit 5.2s linear infinite;
}

:is(
  .intervention-row.primary-project,
  .history-entry.primary-project,
  #weekly-summaryPanel .weekly-summary-rule.primary-project,
  #statsPanel .intervention-stat-row.primary-project
)::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  width: auto;
  height: auto;
  pointer-events: none;
  background:
    linear-gradient(
      108deg,
      transparent 8%,
      color-mix(in srgb, var(--time-accent) 4%, transparent) 34%,
      color-mix(in srgb, var(--time-accent) 17%, transparent) 47%,
      color-mix(in srgb, var(--time-text) 8%, transparent) 52%,
      color-mix(in srgb, var(--time-accent) 5%, transparent) 61%,
      transparent 84%
    );
  background-position: 130% 0;
  background-size: 240% 100%;
  opacity: 0.72;
  animation: main-project-surface-shimmer 6.4s ease-in-out infinite;
}

@keyframes main-project-border-orbit {
  to {
    --project-orbit-angle: 360deg;
  }
}

@keyframes main-project-surface-shimmer {
  0%,
  15% {
    background-position: 130% 0;
    opacity: 0.34;
  }

  50% {
    opacity: 0.76;
  }

  85%,
  100% {
    background-position: -130% 0;
    opacity: 0.34;
  }
}

@media (prefers-reduced-motion: reduce) {
  :is(
    .intervention-row.primary-project,
    .history-entry.primary-project,
    #weekly-summaryPanel .weekly-summary-rule.primary-project,
    #statsPanel .intervention-stat-row.primary-project
  )::before,
  :is(
    .intervention-row.primary-project,
    .history-entry.primary-project,
    #weekly-summaryPanel .weekly-summary-rule.primary-project,
    #statsPanel .intervention-stat-row.primary-project
  )::after {
    animation: none;
  }
}

/* Final placement guard: these rules must stay after legacy mobile overrides. */
.interventions-header,
.history-header {
  min-height: 78px;
  padding: 10px 18px 14px;
}

.interventions-header {
  grid-template-columns: 44px minmax(0, 1fr);
  padding-right: 64px;
}

.history-header {
  grid-template-columns: 44px minmax(0, 1fr);
  padding-right: 78px;
}

.interventions-heading {
  width: min(calc(100% - 190px), 250px);
}

.daily-tally {
  width: 54px;
  min-width: 54px;
  position: absolute;
  top: 14px;
  right: 54px;
}

.history-header .daily-tally {
  right: 18px;
}

.interventions-close {
  top: 10px;
  right: 10px;
}

.participant-preview-tabs {
  margin: var(--stock-section-gap) 18px 0;
}

.interventions-summary {
  min-height: 62px;
  margin: 0 18px;
}

.interventions-scroll,
.history-scroll {
  padding-right: 18px;
  padding-left: 18px;
}

.rule-list,
.history-day-entries {
  gap: 0;
}

.intervention-row:not(.primary-project) {
  min-height: 76px;
  padding: var(--stock-row-gap) 4px;
  border: 0;
  border-bottom: 1px solid transparent;
  border-image-source: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--time-line, #98815a) 44%, transparent) 10%,
    color-mix(in srgb, var(--time-line, #98815a) 44%, transparent) 90%,
    transparent
  );
  border-image-slice: 1;
}

.intervention-row.primary-project {
  min-height: 98px;
  margin: var(--stock-row-gap) 0;
  padding: var(--stock-row-gap) 12px;
}

.history-day-entries {
  padding-top: var(--stock-row-gap);
}

.history-entry:not(.primary-project),
.history-empty {
  min-height: 68px;
  padding: var(--stock-row-gap) 4px;
  border: 0;
  border-bottom: 1px solid transparent;
  border-image-source: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--time-line, #98815a) 42%, transparent) 10%,
    color-mix(in srgb, var(--time-line, #98815a) 42%, transparent) 90%,
    transparent
  );
  border-image-slice: 1;
}

.history-entry.primary-project {
  min-height: 82px;
  margin: var(--stock-row-gap) 0;
  padding: var(--stock-row-gap) 12px;
}

.history-calendar-panel::after,
.history-detail > header::after,
.interventions-header::after,
.history-header::after,
.participant-preview-tabs::after,
.interventions-summary::after {
  opacity: 0.66;
}

@media (max-width: 390px) {
  .interventions-heading {
    width: min(calc(100% - 180px), 220px);
  }

  .interventions-heading h1 {
    font-size: 21px;
  }

  .interventions-heading time {
    font-size: 12px;
  }

  .daily-tally {
    right: 50px;
  }

  .history-header .daily-tally {
    right: 16px;
  }
}

/* Features reserved for a later release. */
.developer-setting, .deferred-equipment, [aria-labelledby="settingsSystemTitle"] {
  display: none !important;
}
.coming-soon {
  position: absolute;
  inset: 50% 0 auto;
  transform: translateY(-50%);
  min-height: 48px;
  display: grid;
  place-items: center;
  padding: 7px 6px;
  pointer-events: none;
  color: var(--time-text-strong);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.35;
  text-align: center;
  text-shadow: 0 2px 0 #000;
}
.window-layer:is([data-tab="shop"], [data-tab="inventory"]) .game-window {
  position: relative;
}
