/* ============================================================
   OVERTIME — style.css
   Aesthetic: kawaii absolute minimalism
   Off-white page, one tiny character, lots of breathing room,
   small moments of delight
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&family=DM+Mono:wght@300;400&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:        #f7f6f2;
  --fg:        #1a1a1a;
  --mid:       #888;
  --faint:     #ccc;
  --accent:    #ff6b6b;       /* salmon — used sparingly */
  --accent2:   #6b8cff;       /* soft blue for alt states */
  --good:      #4caf78;       /* green for positive events */

  --font:      'DM Sans', sans-serif;
  --mono:      'DM Mono', monospace;

  --radius:    12px;
  --gap:       32px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-weight: 300;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── App shell ──────────────────────────────────────────────── */
#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────────── */
#header {
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 300;
  color: var(--mid);
  letter-spacing: 0.02em;
  user-select: none;
}

#ot-display {
  color: var(--accent);
  font-weight: 400;
}

#wh-display {
  color: var(--accent2);
  font-weight: 400;
}

/* ── Stage ──────────────────────────────────────────────────── */
#stage {
  flex: 1;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 48px 24px 250px;  /* bottom clears shelf + log bar */
  text-align: center;
  min-height: 0;
  user-select: none;
}

/* ── Character ──────────────────────────────────────────────── */
#character-wrap {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  user-select: none;
}

#character {
  font-size: 28px;
  line-height: 1;
  font-family: var(--mono);
  font-weight: 300;
  animation: breathe 4s ease-in-out infinite;
  cursor: default;
  user-select: none;
}

#character.tired    { filter: saturate(0.3); opacity: 0.7; }
#character.happy    { animation: bounce 0.5s ease; }
#character.stressed { animation: wobble 0.4s ease; }
#character.guilty   { animation: breathe 7s ease-in-out infinite; opacity: 0.75; }

#speech-bubble {
  font-size: 12px;
  color: var(--mid);
  font-style: italic;
  font-weight: 300;
  max-width: 220px;
  line-height: 1.5;
  animation: fade-in 0.3s ease;
}

/* ── Status line ────────────────────────────────────────────── */
#status-line {
  font-size: 15px;
  font-weight: 300;
  color: var(--fg);
  letter-spacing: -0.01em;
  min-height: 24px;
  transition: opacity 0.3s ease;
}

/* ── Progress ───────────────────────────────────────────────── */
#progress-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 240px;
}

#progress-track {
  width: 100%;
  height: 3px;
  background: var(--faint);
  border-radius: 99px;
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: var(--fg);
  border-radius: 99px;
  transition: width 1s ease, background 0.4s ease;
}

#progress-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mid);
}

/* ── Primary button ─────────────────────────────────────────── */
#btn-primary {
  font-family: var(--font);
  font-weight: 400;
  font-size: 14px;
  letter-spacing: 0.01em;
  color: var(--bg);
  background: var(--fg);
  border: none;
  border-radius: var(--radius);
  padding: 14px 36px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.2s ease, box-shadow 0.2s ease; 
}

#btn-primary:hover {
  background: #333;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  transform: translateY(-1px);
}

#btn-primary:active {
  transform: scale(0.96) translateY(0);
  box-shadow: none;
}

#btn-primary:disabled {
  background: var(--faint);
  color: var(--mid);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#btn-primary.ot-available {
  background: var(--accent);
}

#btn-primary.ot-available:hover {
  background: #ff4f4f;
  box-shadow: 0 4px 24px rgba(255,107,107,0.3);
}

/* ── Event card ─────────────────────────────────────────────── */
#event-card {
  width: 100%;
  max-width: 360px;
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 2px 32px rgba(0,0,0,0.07);
  animation: card-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#event-text {
  font-size: 13px;
  color: var(--fg);
  font-weight: 300;
  line-height: 1.7;
}

#event-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.event-btn {
  font-family: var(--font);
  font-weight: 400;
  font-size: 13px;
  color: var(--fg);
  background: var(--bg);
  border: 1.5px solid var(--faint);
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.event-btn:hover {
  border-color: var(--fg);
  background: white;
}

/* ── Upgrade shelf ──────────────────────────────────────────── */
#upgrade-shelf {
  position: fixed;
  bottom: 40px;        /* sits just above the log bar */
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 0;
  z-index: 100;
}

#shelf-toggle {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 300;
  color: var(--mid);
  background: var(--bg);
  border: none;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: color 0.15s ease;
  padding: 8px 0;
  width: 100%;
  text-align: center;
  position: relative;
  z-index: 1;
  user-select: none;
}

#shelf-toggle:hover { color: var(--fg); }

#upgrade-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 24px 16px;
  width: 100%;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.25s ease;
  user-select: none;
}

#upgrade-grid.open {
  max-height: 600px;
  opacity: 1;
  overflow: visible;
}

.upgrade-card {
  background: white;
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: border-color 0.15s ease, transform 0.1s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.upgrade-card:hover {
  border-color: var(--faint);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.upgrade-card.affordable {
  border-color: var(--accent);
}

.upgrade-card.affordable:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(255,107,107,0.15);
}

.upgrade-card.bought {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

.u-name {
  font-weight: 500;
  font-size: 13px;
}

.u-cost {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
}

.u-cost.bought-label {
  color: var(--good);
}

.u-desc {
  font-size: 11px;
  color: var(--mid);
  line-height: 1.5;
}

/* ── Log bar / footer ───────────────────────────────────────── */
#log-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px 16px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mid);
  background: var(--bg);
  z-index: 101;
  user-select: none;
}

#rank-display {
  font-style: italic;
  flex: 1;
  color: var(--mid);
}

@keyframes rank-pop {
  0%   { opacity: 0; transform: translateY(4px); }
  60%  { opacity: 1; transform: translateY(-2px); }
  100% { opacity: 1; transform: translateY(0); }
}

#rank-display.rank-updated {
  animation: rank-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

#log-latest {
  font-style: italic;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#footer-actions {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
  margin-left: 16px;
}

.ghost-btn {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 300;
  color: var(--mid);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease;
}

.ghost-btn:hover { color: var(--fg); }

/* ── Toast ──────────────────────────────────────────────────── */
#toast-layer {
  position: fixed;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  z-index: 9999;
}

.toast {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 300;
  background: var(--fg);
  color: var(--bg);
  padding: 7px 18px;
  border-radius: 99px;
  white-space: nowrap;
  animation: toast-up 0.25s cubic-bezier(0.34,1.56,0.64,1),
             toast-fade 0.4s ease 2.4s forwards;
  user-select: none;
}

.toast.good { background: var(--good); }
.toast.warn { background: var(--accent); }

/* ── Utility ────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Animations ─────────────────────────────────────────────── */
@keyframes breathe {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-4px); }
}

@keyframes bounce {
  0%   { transform: translateY(0); }
  40%  { transform: translateY(-10px); }
  70%  { transform: translateY(-4px); }
  100% { transform: translateY(0); }
}

@keyframes wobble {
  0%,100% { transform: rotate(0deg); }
  25%     { transform: rotate(-4deg); }
  75%     { transform: rotate(4deg); }
}

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

@keyframes card-in {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

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

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