:root {
  --bg: #f4efe6;
  --ink: #191714;
  --muted: #70695f;
  --line: #dfd5c5;
  --panel: #fffaf0;
  --panel-strong: #2d2a25;
  --accent: #b76835;
  --accent-soft: #f1d5ba;
  --green: #6f8c63;
  --shadow: 0 24px 70px rgba(55, 42, 25, 0.16);
  font-family: ui-serif, Georgia, "Times New Roman", "Songti SC", serif;
}

@property --hold-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 16%, rgba(183, 104, 53, 0.22), transparent 30rem),
    radial-gradient(circle at 85% 18%, rgba(111, 140, 99, 0.2), transparent 28rem),
    linear-gradient(135deg, #fbf6ea 0%, var(--bg) 48%, #eadfcd 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 0;
}

body::before {
  inset: 8px;
  border: 1px solid rgba(183, 104, 53, 0.26);
  border-radius: 32px;
  box-shadow:
    inset 0 0 28px rgba(255, 217, 120, 0.24),
    0 0 36px rgba(183, 104, 53, 0.16);
  animation: pageFrameGlow 4.8s ease-in-out infinite;
}

body::after {
  inset: 0;
  background:
    radial-gradient(circle at 2% 8%, rgba(255, 217, 120, 0.46) 0 2px, transparent 3px),
    radial-gradient(circle at 98% 18%, rgba(183, 104, 53, 0.36) 0 2px, transparent 3px),
    radial-gradient(circle at 92% 92%, rgba(111, 140, 99, 0.34) 0 2px, transparent 3px),
    radial-gradient(circle at 7% 88%, rgba(255, 217, 120, 0.38) 0 2px, transparent 3px);
  filter: drop-shadow(0 0 10px rgba(255, 217, 120, 0.4));
  animation: cornerSparkle 5.4s linear infinite;
}

button {
  font: inherit;
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  color: #fff8ea;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 217, 120, 0.22), transparent 18rem),
    linear-gradient(145deg, rgba(25, 23, 20, 0.96), rgba(48, 38, 26, 0.96));
  transition: opacity 620ms ease, visibility 620ms ease;
}

.loading-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-card {
  width: min(420px, calc(100vw - 48px));
  padding: 28px;
  border: 1px solid rgba(255, 248, 234, 0.14);
  border-radius: 28px;
  background: rgba(255, 248, 234, 0.08);
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.34),
    inset 0 0 34px rgba(255, 217, 120, 0.08);
  backdrop-filter: blur(20px);
}

.loading-card p {
  margin: 0 0 18px;
  color: #ffd978;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
}

.loading-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 248, 234, 0.14);
}

.loading-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, #8f5b25, #ffd978, #fff2ad, #d28a35);
  box-shadow: 0 0 26px rgba(255, 217, 120, 0.44);
  transition: width 520ms cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-shell {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 48px 0;
  display: grid;
  place-items: center;
}

.auth-card {
  width: 100%;
  border: 1px solid rgba(45, 42, 37, 0.12);
  border-radius: 34px;
  padding: clamp(24px, 5vw, 42px);
  background: rgba(255, 250, 240, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-card h1 {
  margin: 0 0 12px;
  font-size: clamp(2.5rem, 8vw, 5.2rem);
  line-height: 0.9;
  letter-spacing: 0;
  text-align: left;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  padding: 6px;
  margin: 28px 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
}

.auth-tab {
  flex: 1;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.auth-tab.is-active {
  color: #fff8ea;
  background: var(--panel-strong);
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form[hidden],
.shell[hidden],
.auth-shell[hidden] {
  display: none;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

.auth-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  color: var(--ink);
  background: #fff8ea;
  outline: none;
  font: inherit;
}

.auth-form input:focus {
  border-color: rgba(183, 104, 53, 0.72);
  box-shadow: 0 0 0 4px rgba(183, 104, 53, 0.12);
}

.primary-button,
.ghost-button {
  border-radius: 999px;
  padding: 11px 16px;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--panel-strong);
  color: #fff8ea;
  background: var(--panel-strong);
}

.ghost-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.45);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100vw - 24px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(238px, 31vw, 300px);
  gap: 16px;
  align-items: stretch;
}

.calendar-card,
.wallet-card {
  border: 1px solid rgba(45, 42, 37, 0.12);
  border-radius: 26px;
  background: rgba(255, 250, 240, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.calendar-card {
  padding: clamp(16px, 2.4vw, 26px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
}

.user-box {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: right;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.25rem);
  line-height: 0.9;
  letter-spacing: 0;
  text-align: right;
}

.toolbar {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.nav-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: #fff8ea;
  cursor: pointer;
  font-size: 2rem;
  line-height: 1;
}

.month-title {
  text-align: center;
  font-size: clamp(1.08rem, 2.4vw, 1.55rem);
  font-weight: 700;
  letter-spacing: 0;
}

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

.weekdays {
  color: var(--muted);
  margin-bottom: 7px;
  font-size: 0.78rem;
  text-align: center;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.76rem;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-holiday {
  background: rgba(112, 105, 95, 0.42);
}

.legend-adjusted {
  background: var(--accent);
}

.legend-hold {
  background: #ffd978;
}

.day {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 9px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.46);
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  touch-action: manipulation;
  user-select: none;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.day::before,
.day::after {
  content: "";
  position: absolute;
  pointer-events: none;
  opacity: 0;
  z-index: 0;
}

.day:hover {
  transform: translateY(-2px);
  border-color: rgba(183, 104, 53, 0.55);
}

.day:disabled {
  cursor: not-allowed;
}

.day.is-empty {
  visibility: hidden;
  pointer-events: none;
}

.day.is-today {
  border-color: var(--accent);
}

.day.is-selected {
  background: var(--panel-strong);
  color: #fff8ea;
  border-color: var(--panel-strong);
}

.day.is-holding {
  z-index: 7;
  border-color: rgba(255, 196, 86, 0.92);
  box-shadow:
    0 0 0 5px rgba(255, 217, 120, 0.2),
    0 18px 42px rgba(183, 104, 53, 0.28),
    0 0 50px rgba(255, 217, 120, 0.26);
  animation: holdGrow var(--hold-duration) linear forwards;
}

.day.is-armed {
  animation: armedPulse 520ms ease;
}

.day.is-adjusted {
  border-color: rgba(183, 104, 53, 0.65);
  background: rgba(241, 213, 186, 0.38);
}

.day.is-adjusted.is-selected {
  color: #fff8ea;
  border-color: var(--panel-strong);
  background: var(--panel-strong);
}

.day.is-disabled {
  color: rgba(112, 105, 95, 0.45);
  border-style: dashed;
  background: rgba(255, 255, 255, 0.24);
}

.day.is-disabled:hover {
  border-color: var(--line);
  transform: none;
}

.day.is-disabled .check {
  display: none;
}

.day:disabled:not(.is-disabled) {
  opacity: 0.68;
}

.day-content {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 4px;
}

.day-number {
  font-size: 1.02rem;
  font-weight: 700;
}

.day-meta {
  max-width: 5.5em;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.15;
}

.day-amount {
  width: fit-content;
  border-radius: 999px;
  padding: 2px 6px;
  color: #fff8ea;
  background: rgba(111, 140, 99, 0.82);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.1;
}

.day.is-selected .day-amount {
  color: #1d1a15;
  background: #ffd978;
}

.day.is-selected .day-meta {
  color: rgba(255, 248, 234, 0.72);
}

.day.is-disabled .day-meta {
  color: rgba(112, 105, 95, 0.45);
}

.check {
  position: relative;
  z-index: 2;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: 0.35;
  display: grid;
  place-items: center;
  transition: transform 180ms ease, background 180ms ease, opacity 180ms ease;
}

.day.is-selected .check {
  opacity: 1;
  background: var(--green);
  border-color: var(--green);
  animation: checkPop 680ms cubic-bezier(0.16, 1, 0.3, 1);
}

.day.is-selected .check::after {
  content: "✓";
  font-size: 0.9rem;
  transform-origin: 50% 50%;
  animation: tickFlash 720ms ease;
}

.hold-ring {
  position: absolute;
  inset: 5px;
  z-index: 1;
  border-radius: 13px;
  padding: 3px;
  background: conic-gradient(from -90deg, #ffd978 var(--hold-angle), rgba(255, 217, 120, 0.13) 0);
  opacity: 0;
  pointer-events: none;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.day.is-holding .hold-ring {
  opacity: 1;
  animation: holdSweep var(--hold-duration) linear forwards;
}

.day.is-holding .day-number {
  animation: pressNumber 850ms ease-in-out infinite alternate;
}

.ribbon {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffd978, #e98045, #6f8c63, #ffd978);
  box-shadow: 0 6px 14px rgba(183, 104, 53, 0.24);
}

.ribbon-a {
  top: -4px;
  left: 12px;
  width: 60px;
  height: 7px;
  transform: rotate(-14deg);
}

.ribbon-b {
  right: -8px;
  top: 26px;
  width: 52px;
  height: 7px;
  transform: rotate(58deg);
}

.ribbon-c {
  left: 10px;
  bottom: -5px;
  width: 56px;
  height: 7px;
  transform: rotate(11deg);
}

.ribbon-d {
  left: -9px;
  top: 40px;
  width: 48px;
  height: 7px;
  transform: rotate(72deg);
}

.day.is-celebrating {
  z-index: 8;
  animation: dayTriumph 1.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.day.is-celebrating::before {
  inset: -22px;
  opacity: 1;
  background:
    radial-gradient(circle, #ffd978 0 3px, transparent 4px) 18% 16% / 24px 24px,
    radial-gradient(circle, #e98045 0 2px, transparent 3px) 82% 20% / 22px 22px,
    radial-gradient(circle, #6f8c63 0 2px, transparent 3px) 20% 78% / 20px 20px,
    radial-gradient(circle, #f7c962 0 2px, transparent 3px) 80% 82% / 26px 26px;
  animation: confettiBurst 1.2s ease-out forwards;
}

.day.is-celebrating::after {
  inset: -4px;
  border-radius: inherit;
  opacity: 1;
  background: linear-gradient(120deg, transparent, rgba(255, 217, 120, 0.42), transparent);
  transform: translateX(-120%);
  animation: victorySweep 900ms ease-out forwards;
}

.day.is-celebrating .ribbon {
  animation: ribbonFly 1.24s ease-out forwards;
}

.wallet-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  background:
    radial-gradient(circle at 18% 8%, rgba(247, 201, 98, 0.34), transparent 9rem),
    radial-gradient(circle at 90% 18%, rgba(111, 140, 99, 0.32), transparent 9rem),
    linear-gradient(160deg, #30261a 0%, #171410 54%, #2a1d12 100%);
  color: #fff8ea;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  min-height: 0;
  transform-style: preserve-3d;
  transition:
    background 620ms ease,
    min-height 620ms cubic-bezier(0.16, 1, 0.3, 1);
}

.wallet-card.is-vault-mode {
  min-height: clamp(440px, 72vh, 760px);
  justify-content: center;
  background:
    radial-gradient(circle at 50% 100%, rgba(247, 201, 98, 0.2), transparent 13rem),
    linear-gradient(160deg, #261c12 0%, #11100e 58%, #2d2115 100%);
}

.wallet-card.is-money-burst {
  animation: walletGlow 920ms ease-out;
}

.wallet-card.is-wallet-jump .wallet-icon {
  animation: walletJump 920ms cubic-bezier(0.16, 1, 0.3, 1);
}

.wallet-card.is-wallet-open .wallet-icon,
.wallet-card.is-wallet-closing .wallet-icon {
  transition:
    top 760ms cubic-bezier(0.16, 1, 0.3, 1),
    bottom 760ms cubic-bezier(0.16, 1, 0.3, 1),
    left 760ms cubic-bezier(0.16, 1, 0.3, 1),
    margin 760ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 760ms cubic-bezier(0.16, 1, 0.3, 1);
}

.wallet-card::before {
  content: "";
  position: absolute;
  inset: auto -36px -70px auto;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(229, 176, 78, 0.22), transparent 66%);
}

.wallet-card::after {
  content: "¥ ¥ ¥";
  position: absolute;
  right: -16px;
  top: 74px;
  color: rgba(255, 248, 234, 0.06);
  font-size: 4.4rem;
  font-weight: 800;
  letter-spacing: 0;
  transform: rotate(-16deg);
  transition: opacity 340ms ease;
}

.wallet-card.is-vault-mode::after {
  opacity: 0;
}

.money-glow {
  position: absolute;
  inset: 18px 18px auto auto;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(247, 211, 123, 0.5), transparent 68%);
  filter: blur(2px);
  animation: moneyGlowDrift 4.2s ease-in-out infinite;
}

.wallet-total,
.wallet-icon,
.wallet-stats,
.rate-note,
.salary-panel,
.salary-form {
  position: relative;
  z-index: 1;
}

.wallet-stats,
.rate-note,
.wallet-total,
.salary-panel,
.salary-form {
  transition:
    opacity 320ms ease,
    transform 320ms ease,
    filter 320ms ease;
}

.wallet-card.is-vault-mode .wallet-stats,
.wallet-card.is-vault-mode .rate-note,
.wallet-card.is-vault-mode .wallet-total,
.wallet-card.is-vault-mode .salary-panel,
.wallet-card.is-vault-mode .salary-form {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.98);
  filter: blur(5px);
}

.wallet-card.is-vault-mode .money-glow {
  opacity: 0.34;
}

.wallet-icon {
  z-index: 6;
  width: 160px;
  height: 116px;
  margin: -4px auto -12px;
  position: relative;
  cursor: pointer;
  outline: none;
  transition:
    top 780ms cubic-bezier(0.16, 1, 0.3, 1),
    bottom 780ms cubic-bezier(0.16, 1, 0.3, 1),
    left 780ms cubic-bezier(0.16, 1, 0.3, 1),
    margin 780ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 780ms cubic-bezier(0.16, 1, 0.3, 1),
    filter 260ms ease;
}

.wallet-icon:focus-visible {
  filter:
    drop-shadow(0 0 0.5rem rgba(255, 217, 120, 0.52))
    drop-shadow(0 0 1.2rem rgba(255, 217, 120, 0.24));
}

.wallet-card.is-vault-mode .wallet-icon {
  position: absolute;
  left: 50%;
  top: 26px;
  margin: 0;
  transform: translateX(-50%) scale(0.96);
}

.wallet-card.is-vault-pouring .wallet-icon {
  transform: translateX(-50%) translateY(3px) rotate(-17deg) scale(0.98);
}

.wallet-card.is-vault-filled .wallet-icon {
  transform: translateX(-50%) scale(0.94);
}

.wallet-card.is-vault-returning .wallet-icon {
  top: calc(100% - 146px);
  bottom: auto;
  transform: translateX(-50%) rotate(3deg) scale(0.96);
}

.wallet-flap {
  position: absolute;
  left: 20px;
  top: 10px;
  width: 104px;
  height: 50px;
  border-radius: 24px 24px 8px 8px;
  background:
    linear-gradient(135deg, rgba(255, 240, 180, 0.72), transparent 38%),
    linear-gradient(135deg, #e9b05d, #9b5a2f);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.22);
  transform: rotate(-9deg);
  transform-origin: 18% 94%;
  transition:
    transform 820ms cubic-bezier(0.16, 1, 0.3, 1),
    border-radius 820ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 820ms ease;
}

.wallet-body {
  position: absolute;
  inset: 34px 0 0;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 232, 158, 0.24), transparent 36%),
    linear-gradient(135deg, #c47736, #5c3828);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.2),
    0 24px 46px rgba(0, 0, 0, 0.28);
  transform-origin: 50% 100%;
  transition:
    transform 820ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 820ms ease,
    filter 820ms ease;
}

.wallet-body::before,
.wallet-body::after {
  content: "";
  position: absolute;
  left: 22px;
  right: 58px;
  height: 1px;
  background: rgba(255, 232, 184, 0.22);
}

.wallet-body::before {
  top: 30px;
}

.wallet-body::after {
  top: 44px;
}

.wallet-body span {
  position: absolute;
  right: 16px;
  top: 26px;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff0b6, #d7a13d 62%, #8b6026);
  box-shadow: 0 0 0 7px rgba(255, 228, 145, 0.08);
  transition:
    transform 760ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 760ms ease;
}

.wallet-card.is-wallet-open .wallet-flap {
  border-radius: 28px 28px 10px 10px;
  transform: translateY(-27px) rotate(-25deg) scaleX(1.08);
  box-shadow:
    0 22px 44px rgba(0, 0, 0, 0.26),
    0 0 32px rgba(255, 217, 120, 0.22);
}

.wallet-card.is-wallet-open .wallet-body {
  transform: translateY(8px) scale(1.04);
  filter: brightness(1.08) saturate(1.08);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.26),
    0 30px 58px rgba(0, 0, 0, 0.32),
    0 0 46px rgba(255, 217, 120, 0.2);
}

.wallet-card.is-wallet-open .wallet-body span {
  transform: scale(1.2);
  box-shadow:
    0 0 0 9px rgba(255, 228, 145, 0.12),
    0 0 30px rgba(255, 217, 120, 0.42);
}

.coin {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #70431f;
  background:
    radial-gradient(circle at 34% 28%, #fff6c4, #e4b649 58%, #9b6a25);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.28),
    0 13px 24px rgba(0, 0, 0, 0.28);
  font-weight: 800;
  animation: coinFloat 3.6s ease-in-out infinite;
}

.coin-one {
  right: 12px;
  top: 2px;
  width: 38px;
  height: 38px;
}

.coin-two {
  left: 0;
  bottom: 10px;
  width: 28px;
  height: 28px;
  font-size: 0.82rem;
  animation-delay: -1.2s;
}

.coin-vault,
.vault-coins {
  position: absolute;
  inset: 14px;
  pointer-events: none;
}

.coin-vault {
  z-index: 2;
  overflow: hidden;
  border: 1px solid rgba(255, 217, 120, 0.22);
  border-radius: 24px;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 100%, rgba(255, 217, 120, 0.11), transparent 12rem),
    linear-gradient(180deg, rgba(255, 248, 234, 0.045), rgba(255, 248, 234, 0.015));
  box-shadow:
    inset 0 -28px 54px rgba(0, 0, 0, 0.28),
    inset 0 0 0 1px rgba(255, 248, 234, 0.05);
  transform-origin: 50% 50%;
  transition: opacity 360ms ease;
}

.wallet-card.is-vault-mode .coin-vault {
  opacity: 1;
}

.wallet-card.is-vault-returning .coin-vault {
  animation: vaultInvert 2.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.vault-coins {
  z-index: 4;
  overflow: hidden;
}

.vault-coin {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--coin-size, 16px);
  height: var(--coin-size, 16px);
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #70431f;
  opacity: 0;
  background:
    radial-gradient(circle at 35% 27%, #fff8c8, #ffd978 46%, #c5862e 72%, #6f421c);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.36),
    0 0 18px rgba(255, 217, 120, 0.44),
    0 10px 18px rgba(0, 0, 0, 0.28);
  font-size: calc(var(--coin-size, 16px) * 0.46);
  font-weight: 900;
  line-height: 1;
  backface-visibility: hidden;
  contain: layout paint style;
  will-change: transform, opacity, filter;
  animation: vaultCoinDrop var(--drop-duration, 1160ms) cubic-bezier(0.15, 0.72, 0.2, 1) var(--drop-delay, 0ms) both;
}

.vault-coin.is-returning {
  animation: vaultCoinReturn var(--return-duration, 1280ms) cubic-bezier(0.2, 0.78, 0.28, 1) var(--return-delay, 0ms) both;
}

.summary-label {
  margin: 0 0 8px;
  color: rgba(255, 248, 234, 0.62);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.grand-total {
  display: block;
  color: #ffd978;
  font-size: clamp(2.1rem, 4vw, 3.2rem);
  line-height: 0.92;
  letter-spacing: 0;
  text-shadow: 0 14px 34px rgba(247, 201, 98, 0.22);
}

.wallet-card strong,
.rate-note span,
.total-note {
  font-variant-numeric: tabular-nums;
}

.is-rolling {
  display: inline-block;
  animation: numberRoll 620ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, filter;
}

.total-note {
  display: inline-flex;
  margin-top: 6px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 248, 234, 0.14);
  border-radius: 999px;
  color: rgba(255, 248, 234, 0.7);
  background: rgba(255, 248, 234, 0.07);
  font-size: 0.75rem;
}

.wallet-stats {
  display: grid;
  gap: 8px;
}

.stat-card {
  border: 1px solid rgba(255, 248, 234, 0.12);
  border-radius: 16px;
  padding: 10px 11px;
  background: rgba(255, 248, 234, 0.08);
}

.stat-card span,
.rate-note {
  color: rgba(255, 248, 234, 0.56);
  font-size: 0.74rem;
}

.stat-card strong {
  display: block;
  margin-top: 3px;
  font-size: 1.08rem;
  letter-spacing: 0;
}

.stat-primary {
  border-color: rgba(255, 217, 120, 0.28);
  background: rgba(255, 217, 120, 0.12);
}

.stat-primary strong {
  color: #ffd978;
  font-size: 1.42rem;
}

.rate-note {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: -2px 0 0;
  padding: 0 2px;
}

.rate-note span {
  color: rgba(255, 248, 234, 0.72);
}

.salary-panel {
  border: 1px solid rgba(255, 248, 234, 0.12);
  border-radius: 16px;
  background: rgba(255, 248, 234, 0.08);
}

.salary-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  color: rgba(255, 248, 234, 0.76);
  cursor: pointer;
  list-style: none;
}

.salary-panel summary::-webkit-details-marker {
  display: none;
}

.salary-panel summary span {
  font-size: 0.82rem;
}

.salary-panel summary strong {
  border: 1px solid rgba(255, 217, 120, 0.32);
  border-radius: 999px;
  padding: 4px 8px;
  color: #ffd978;
  background: rgba(255, 217, 120, 0.08);
  font-size: 0.72rem;
  font-weight: 700;
}

.salary-panel[open] summary {
  border-bottom: 1px solid rgba(255, 248, 234, 0.1);
}

.salary-form {
  display: grid;
  gap: 8px;
  padding: 10px;
}

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

.salary-mode label {
  cursor: pointer;
}

.salary-mode input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.salary-mode span {
  display: grid;
  place-items: center;
  min-height: 34px;
  border: 1px solid rgba(255, 248, 234, 0.14);
  border-radius: 999px;
  color: rgba(255, 248, 234, 0.7);
  background: rgba(255, 248, 234, 0.06);
  font-size: 0.82rem;
}

.salary-mode input:checked + span {
  border-color: rgba(255, 217, 120, 0.44);
  color: #1d1a15;
  background: #ffd978;
}

.salary-field {
  display: grid;
  gap: 4px;
  color: rgba(255, 248, 234, 0.58);
  font-size: 0.72rem;
}

.salary-field input {
  width: 100%;
  border: 1px solid rgba(255, 248, 234, 0.14);
  border-radius: 12px;
  padding: 8px 9px;
  color: #fff8ea;
  background: rgba(255, 248, 234, 0.08);
  outline: none;
  font: inherit;
}

.salary-field input:focus {
  border-color: rgba(255, 217, 120, 0.48);
  box-shadow: 0 0 0 3px rgba(255, 217, 120, 0.12);
}

.salary-save {
  border: 1px solid rgba(255, 217, 120, 0.44);
  border-radius: 999px;
  padding: 9px 12px;
  color: #1d1a15;
  background: #ffd978;
  cursor: pointer;
}

.salary-save:disabled {
  cursor: wait;
  opacity: 0.62;
}

.wallet-total {
  margin-top: 0;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 248, 234, 0.12);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(25, 23, 20, 0.9);
  color: #fff8ea;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

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

.page-effects {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow: hidden;
  pointer-events: none;
  contain: layout paint style;
}

.effect-ribbon,
.firework-spark,
.flying-coin {
  position: fixed;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(0, 0, 0) scale(0);
  transform-origin: center;
  backface-visibility: hidden;
  contain: layout paint style;
  will-change: transform, opacity, filter;
}

.effect-ribbon {
  top: -28px;
  width: 13px;
  height: 46px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.52), transparent 32%),
    var(--effect-color);
  box-shadow: 0 0 14px rgba(255, 217, 120, 0.44);
  animation: ribbonRain 7.2s linear both;
}

.firework-spark {
  width: var(--spark-size, 9px);
  height: var(--spark-size, 9px);
  border-radius: 50%;
  background: var(--spark-color);
  box-shadow:
    0 0 0 5px rgba(255, 217, 120, 0.16),
    0 0 24px var(--spark-color);
}

.firework-spark.from-bottom {
  bottom: -18px;
  animation: fireworkFountainUp 5s cubic-bezier(0.15, 0.74, 0.32, 1) both;
}

.firework-spark.from-top {
  top: -18px;
  animation: fireworkFountainDown 5s cubic-bezier(0.15, 0.74, 0.32, 1) both;
}

.firework-spark.from-side {
  animation: fireworkSide 5s cubic-bezier(0.15, 0.74, 0.32, 1) both;
}

.firework-spark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--spark-color), transparent);
  transform: translate(-50%, -8px);
}

.firework-spark.from-top::after {
  transform: translate(-50%, -28px) rotate(180deg);
}

.firework-spark.from-left::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.firework-spark.from-right::after {
  transform: translate(-50%, -50%) rotate(-90deg);
}

.flying-coin {
  z-index: 40;
  width: var(--coin-size, 22px);
  height: var(--coin-size, 22px);
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #6f421c;
  background:
    radial-gradient(circle at 35% 28%, #fff8c8, #ffd978 48%, #c5862e 72%, #6f421c);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.34),
    0 0 22px rgba(255, 217, 120, 0.62),
    0 14px 24px rgba(45, 42, 37, 0.22);
  font-size: calc(var(--coin-size, 22px) * 0.45);
  font-weight: 900;
  animation: coinToWallet 3.8s cubic-bezier(0.17, 0.84, 0.28, 1) both;
}

@keyframes pageFrameGlow {
  0%, 100% {
    opacity: 0.72;
    box-shadow:
      inset 0 0 24px rgba(255, 217, 120, 0.18),
      0 0 30px rgba(183, 104, 53, 0.12);
  }
  50% {
    opacity: 1;
    box-shadow:
      inset 0 0 42px rgba(255, 217, 120, 0.3),
      0 0 58px rgba(183, 104, 53, 0.22);
  }
}

@keyframes cornerSparkle {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.76;
  }
  50% {
    transform: translate3d(0, -5px, 0) scale(1.015);
    opacity: 1;
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.76;
  }
}

@keyframes holdSweep {
  from {
    --hold-angle: 0deg;
  }
  to {
    --hold-angle: 360deg;
  }
}

@keyframes holdGrow {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.38);
    filter: brightness(1.08) saturate(1.16);
  }
  100% {
    transform: scale(2);
    filter: brightness(1.2) saturate(1.32);
  }
}

@keyframes pressNumber {
  from {
    transform: translateY(0) scale(1);
    color: currentColor;
  }
  to {
    transform: translateY(-2px) scale(1.08);
    color: #b76835;
  }
}

@keyframes armedPulse {
  0% {
    transform: scale(0.96);
  }
  65% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes checkPop {
  0% {
    transform: scale(0.2) rotate(-28deg);
    opacity: 0;
  }
  55% {
    transform: scale(1.24) rotate(8deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

@keyframes tickFlash {
  0% {
    transform: scale(0) rotate(-40deg);
    opacity: 0;
  }
  55% {
    transform: scale(1.35) rotate(8deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

@keyframes dayTriumph {
  0% {
    transform: scale(1.18);
    box-shadow: 0 0 0 rgba(255, 217, 120, 0);
  }
  22% {
    transform: scale(1.32);
    box-shadow:
      0 0 0 14px rgba(255, 217, 120, 0.18),
      0 26px 54px rgba(183, 104, 53, 0.34);
  }
  48% {
    transform: scale(0.92);
    box-shadow:
      0 0 0 34px rgba(255, 217, 120, 0),
      0 18px 34px rgba(255, 217, 120, 0.26);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(255, 217, 120, 0);
  }
}

@keyframes confettiBurst {
  0% {
    transform: scale(0.35) rotate(0deg);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    transform: scale(1.85) rotate(36deg);
    opacity: 0;
  }
}

@keyframes victorySweep {
  to {
    transform: translateX(130%);
  }
}

@keyframes ribbonFly {
  0% {
    opacity: 0;
    filter: blur(2px);
  }
  25% {
    opacity: 1;
    filter: blur(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-18px) rotate(26deg) scale(1.18);
  }
}

@keyframes ribbonRain {
  0% {
    transform: translate3d(0, -30px, 0) rotate(0deg) scaleY(0.85);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--fall-x), 112vh, 0) rotate(var(--fall-rot)) scaleY(1.15);
    opacity: 0;
  }
}

@keyframes fireworkFountainUp {
  0% {
    transform: translate3d(0, 0, 0) scale(0.7);
    opacity: 0;
  }
  16% {
    opacity: 1;
  }
  72% {
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--spark-x), var(--spark-y), 0) scale(0.16);
    opacity: 0;
    filter: blur(2px);
  }
}

@keyframes fireworkFountainDown {
  0% {
    transform: translate3d(0, 0, 0) scale(0.7);
    opacity: 0;
  }
  16% {
    opacity: 1;
  }
  72% {
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--spark-x), var(--spark-y), 0) scale(0.16);
    opacity: 0;
    filter: blur(2px);
  }
}

@keyframes fireworkSide {
  0% {
    transform: translate3d(0, 0, 0) scale(0.7);
    opacity: 0;
  }
  16% {
    opacity: 1;
  }
  72% {
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--spark-x), var(--spark-y), 0) scale(0.16);
    opacity: 0;
    filter: blur(2px);
  }
}

@keyframes coinToWallet {
  0% {
    transform: translate3d(0, 0, 0) rotateY(0deg) scale(0.28);
    opacity: 0;
    filter: blur(1px);
  }
  12% {
    transform: translate3d(var(--coin-burst-x), var(--coin-burst-y), 0) rotateY(160deg) scale(1.24);
    opacity: 1;
    filter: blur(0);
  }
  62% {
    transform: translate3d(var(--coin-mid-x), var(--coin-mid-y), 0) rotateY(620deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--coin-end-x), var(--coin-end-y), 0) rotateY(980deg) scale(0.24);
    opacity: 0;
    filter: blur(1px);
  }
}

@keyframes vaultCoinDrop {
  0% {
    transform: translate3d(var(--start-x), calc(var(--start-y) - 22px), 0) rotate(var(--start-rot)) scale(0.48);
    opacity: 0;
    filter: blur(1px);
  }
  12% {
    opacity: 1;
    filter: blur(0);
  }
  48% {
    transform: translate3d(var(--mid-x), var(--mid-y), 0) rotate(260deg) scale(1);
    opacity: 1;
  }
  80% {
    transform: translate3d(var(--end-x), calc(var(--end-y) + 9px), 0) rotate(520deg) scaleX(1.08) scaleY(0.82);
  }
  92% {
    transform: translate3d(var(--end-x), calc(var(--end-y) - 5px), 0) rotate(610deg) scaleX(0.94) scaleY(1.05);
  }
  100% {
    transform: translate3d(var(--end-x), var(--end-y), 0) rotate(var(--end-rot)) scale(1);
    opacity: 1;
    filter: blur(0);
  }
}

@keyframes vaultCoinReturn {
  0% {
    transform: translate3d(var(--end-x), var(--end-y), 0) rotate(var(--end-rot)) scale(1);
    opacity: 1;
    filter: blur(0);
  }
  38% {
    transform: translate3d(var(--return-mid-x), var(--return-mid-y), 0) rotate(420deg) scale(0.96);
    opacity: 1;
  }
  82% {
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--return-x), var(--return-y), 0) rotate(780deg) scale(0.26);
    opacity: 0;
    filter: blur(1px);
  }
}

@keyframes vaultInvert {
  0% {
    transform: rotate(0deg) scale(1);
    box-shadow:
      inset 0 -28px 54px rgba(0, 0, 0, 0.28),
      inset 0 0 0 1px rgba(255, 248, 234, 0.05);
  }
  34% {
    transform: rotate(182deg) scale(0.985);
    box-shadow:
      inset 0 34px 64px rgba(0, 0, 0, 0.34),
      inset 0 0 38px rgba(255, 217, 120, 0.12);
  }
  70% {
    transform: rotate(180deg) scale(0.985);
  }
  100% {
    transform: rotate(360deg) scale(1);
    box-shadow:
      inset 0 -28px 54px rgba(0, 0, 0, 0.28),
      inset 0 0 0 1px rgba(255, 248, 234, 0.05);
  }
}

@keyframes coinFloat {
  0%, 100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-8px) rotate(6deg);
  }
}

@keyframes moneyGlowDrift {
  0%, 100% {
    opacity: 0.72;
    transform: translateY(0) scale(1);
  }
  50% {
    opacity: 1;
    transform: translateY(10px) scale(1.1);
  }
}

@keyframes walletGlow {
  0% {
    box-shadow: var(--shadow);
  }
  45% {
    box-shadow:
      var(--shadow),
      0 0 44px rgba(255, 217, 120, 0.32),
      inset 0 0 26px rgba(255, 217, 120, 0.12);
  }
  100% {
    box-shadow: var(--shadow);
  }
}

@keyframes walletJump {
  0% {
    transform: translateY(0) scale(1) rotate(0deg);
  }
  24% {
    transform: translateY(-18px) scale(1.08) rotate(-5deg);
  }
  48% {
    transform: translateY(4px) scale(0.96) rotate(3deg);
  }
  72% {
    transform: translateY(-8px) scale(1.03) rotate(-2deg);
  }
  100% {
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

@keyframes numberRoll {
  0% {
    transform: translateY(0.72em) rotateX(-70deg) scale(0.94);
    filter: blur(5px);
    opacity: 0.35;
  }
  58% {
    transform: translateY(-0.12em) rotateX(18deg) scale(1.05);
    filter: blur(0);
    opacity: 1;
  }
  100% {
    transform: translateY(0) rotateX(0) scale(1);
    filter: blur(0);
    opacity: 1;
  }
}

@media (max-width: 620px) {
  .shell {
    grid-template-columns: 1fr;
    padding: 14px 0;
  }

  .wallet-card {
    min-height: auto;
  }

  .topbar {
    flex-direction: column-reverse;
  }

  .user-box {
    width: 100%;
    justify-content: space-between;
  }

  .eyebrow,
  h1 {
    text-align: left;
  }

  .day {
    min-height: 58px;
    border-radius: 16px;
    padding: 9px;
  }

  .check {
    width: 20px;
    height: 20px;
  }
}

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