@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;600;700;800&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --border: #e0e0e0;
  --text: #111111;
  --text-muted: #999999;
  --text-faint: #cccccc;
  --green: #22c55e;
  --red: #F00025;
  --safe-top: env(safe-area-inset-top, 44px);
  --safe-bottom: env(safe-area-inset-bottom, 20px);
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Nunito', sans-serif;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  overflow: hidden;
}

/* ── HEADER ── */
.header {
  flex-shrink: 0;
  padding: 16px 24px 0;
  text-align: center;
}

.month-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── MAIN — 70% of screen ── */
.main {
  flex: 0 0 68%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* ── SVG RESET RING ── */
.reset-ring {
  position: absolute;
  width: 330px;
  height: 330px;
  transform: rotate(-90deg);
  pointer-events: none;
  z-index: 2;
}

.reset-ring-track {
  fill: none;
  stroke: transparent;
  stroke-width: 4;
}

.reset-ring-fill {
  fill: none;
  stroke: var(--red);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 955; /* 2π × 152 */
  stroke-dashoffset: 955;
  transition: stroke-dashoffset 0.05s linear;
  opacity: 0;
}

.reset-ring-fill.active {
  opacity: 1;
}

/* ── BIG BUTTON ── */
.total-btn {
  width: 300px;
  height: 300px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;

  background: #ffffff;
  box-shadow:
    0 2px 0 #c8c8c8,
    0 8px 20px rgba(0,0,0,0.10),
    0 20px 48px rgba(0,0,0,0.06),
    inset 0 1px 0 rgba(255,255,255,0.9),
    inset 0 -2px 6px rgba(0,0,0,0.05);

  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.total-btn.pressed {
  transform: scale(0.97) translateY(2px);
  box-shadow:
    0 0px 0 #c8c8c8,
    0 3px 10px rgba(0,0,0,0.10),
    0 8px 24px rgba(0,0,0,0.06),
    inset 0 1px 0 rgba(255,255,255,0.9),
    inset 0 -1px 3px rgba(0,0,0,0.05);
}

.total-btn.flash .amount {
  color: var(--green);
  transform: scale(1.06);
}

.amount-wrap {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}

.amount {
  font-size: 88px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  letter-spacing: -4px;
  transition: color 0.25s ease, transform 0.2s ease;
}

.currency {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  padding-bottom: 8px;
}

.currency-ghost {
  font-size: 26px;
  font-weight: 700;
  color: transparent;
  padding-bottom: 8px;
  pointer-events: none;
  visibility: hidden;
}

/* ── LOG SECTION — remaining 30% ── */
.log-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-top: 1px solid var(--border);
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px 8px;
  flex-shrink: 0;
}

.log-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.log-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
}

.log-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  padding: 0 8px 8px 24px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #d0d0d0 transparent;
}

.log-list::-webkit-scrollbar {
  width: 3px;
}

.log-list::-webkit-scrollbar-track {
  background: transparent;
}

.log-list::-webkit-scrollbar-thumb {
  background: #d0d0d0;
  border-radius: 99px;
}

.log-empty {
  text-align: center;
  padding: 20px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-faint);
}

.log-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  animation: slideIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.log-item:last-child {
  border-bottom: none;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.log-date {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.log-amount {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 28px);
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--text);
  color: #ffffff;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 9px 22px;
  border-radius: 100px;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  white-space: nowrap;
  z-index: 100;
}

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