* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(180deg, #0f0c29 0%, #302b63 25%, #6a3d8f 50%, #c9623f 75%, #f4a259 100%);
  background-attachment: fixed;
  color: #e8e0f0; min-height: 100vh;
  padding: 20px; display: flex; justify-content: center;
}
.app { width: 100%; max-width: 1100px; }

/* ВХОД */
.auth-screen {
  max-width: 420px; margin: 80px auto 0;
  background: rgba(30, 20, 50, 0.6);
  border: 1px solid rgba(200, 160, 220, 0.3);
  border-radius: 20px; padding: 32px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
  text-align: center;
}
.auth-screen h1 {
  font-size: 32px; margin-bottom: 8px;
  background: linear-gradient(90deg, #ffd166, #c9623f, #a855f7);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-screen .sub { font-size: 13px; color: #b8a8c8; margin-bottom: 24px; }
.auth-screen input {
  width: 100%; padding: 14px 16px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(200, 160, 220, 0.3);
  border-radius: 10px; color: #e8e0f0;
  font-size: 15px; font-family: inherit;
  margin-bottom: 12px;
}
.auth-screen input:focus {
  outline: none; border-color: #ffd166;
  box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.2);
}
.auth-screen button {
  width: 100%; padding: 14px;
  background: #fbbf24; color: #2a2410;
  border: none; border-radius: 10px;
  font-size: 15px; font-weight: 700;
  cursor: pointer; font-family: inherit;
  margin-bottom: 8px;
}
.auth-screen button:hover { background: #fcd34d; }
.auth-screen button.secondary {
  background: transparent; color: #b8a8c8;
  border: 1px solid rgba(200, 160, 220, 0.3);
  font-weight: 500;
}
.auth-screen button.secondary:hover { background: rgba(200, 160, 220, 0.1); }
.auth-error { color: #ef4444; font-size: 13px; margin-top: 8px; min-height: 20px; }
.auth-info { color: #10b981; font-size: 12px; margin-top: 12px; line-height: 1.4; }

/* ИГРА */
.game { display: none; }
.game.active { display: block; }

.header { text-align: center; margin-bottom: 14px; }
h1 { font-size: 30px; margin-bottom: 4px;
  background: linear-gradient(90deg, #ffd166, #c9623f, #a855f7);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.subtitle { font-size: 12px; color: #b8a8c8; }

.user-bar {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(30, 20, 50, 0.5);
  border: 1px solid rgba(200, 160, 220, 0.2);
  border-radius: 12px; padding: 10px 16px;
  margin-bottom: 14px; font-size: 13px;
}
.user-bar .nick { color: #ffd166; font-weight: 700; }
.user-bar .sync { color: #10b981; font-size: 11px; }
.user-bar button {
  background: transparent; color: #b8a8c8;
  border: 1px solid rgba(200, 160, 220, 0.3);
  border-radius: 8px; padding: 6px 12px;
  font-size: 12px; cursor: pointer; font-family: inherit;
}
.user-bar button:hover { background: rgba(200, 160, 220, 0.1); }

.card {
  background: rgba(30, 20, 50, 0.4);
  border: 1px solid rgba(200, 160, 220, 0.2);
  border-radius: 16px; padding: 18px;
  margin-bottom: 14px; backdrop-filter: blur(8px);
}
h2 { font-size: 15px; margin-bottom: 10px; color: #d8c8e8; letter-spacing: 1px; }

/* РЕЙТИНГ */
.rating-card {
  background: rgba(30, 20, 50, 0.5);
  border: 1px solid rgba(255, 209, 102, 0.25);
  border-radius: 16px; padding: 16px 18px;
  margin-bottom: 14px; backdrop-filter: blur(8px);
}
.rating-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.rating-title {
  font-size: 14px; font-weight: 700; letter-spacing: 2px;
  color: #ffd166; text-transform: uppercase;
}
.rating-toggle {
  background: transparent; color: #b8a8c8;
  border: 1px solid rgba(200, 160, 220, 0.3);
  border-radius: 8px; padding: 4px 10px;
  font-size: 11px; cursor: pointer; font-family: inherit;
}
.rating-toggle:hover { background: rgba(200, 160, 220, 0.1); color: #d8c8e8; }

.rating-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
  margin-bottom: 6px;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.rating-row:last-child { margin-bottom: 0; }
.rating-row.gold   { border-left-color: #ffd166; }
.rating-row.silver { border-left-color: #c0c0c0; }
.rating-row.bronze { border-left-color: #cd7f32; }
.rating-row.me {
  background: rgba(255, 209, 102, 0.12);
  box-shadow: 0 0 16px rgba(255, 209, 102, 0.15);
}
.rating-row.extra { margin-top: 6px; border-top: 1px dashed rgba(200, 160, 220, 0.2); padding-top: 10px; }

.rating-place { font-size: 18px; min-width: 32px; text-align: center; }
.rating-nick { flex: 1; font-size: 14px; font-weight: 700; color: #e8e0f0; }
.rating-row.me .rating-nick { color: #ffd166; }
.rating-you {
  font-size: 9px; font-weight: 700;
  background: #ffd166; color: #2a2410;
  padding: 2px 6px; border-radius: 6px;
  margin-left: 6px; text-transform: uppercase;
}
.rating-stats { display: flex; gap: 12px; font-size: 11px; color: #b8a8c8; flex-wrap: wrap; justify-content: flex-end; }
.rating-stat { text-align: center; min-width: 38px; }
.rating-stat .v { font-size: 13px; font-weight: 700; color: #e8e0f0; display: block; }
.rating-stat .n { font-size: 8px; text-transform: uppercase; letter-spacing: 0.3px; }
.rating-stat.gold .v { color: #ffd166; }
.rating-stat.streak .v { color: #60a5fa; }
.rating-stat.built .v { color: #a855f7; }
.rating-stat.days .v { color: #10b981; }
.rating-empty { color: #8a7a9a; font-size: 12px; font-style: italic; text-align: center; padding: 8px; }

/* ЭПОХА */
.epoch-banner {
  text-align: center; padding: 14px;
  background: linear-gradient(90deg, rgba(255,209,102,0.15), rgba(168,85,247,0.15));
  border-radius: 12px; border: 1px solid rgba(255, 209, 102, 0.25);
}
.epoch-icon { font-size: 44px; line-height: 1; margin-bottom: 4px;
  filter: drop-shadow(0 0 12px rgba(255,209,102,0.5)); }
.epoch-name { font-size: 20px; font-weight: 700; letter-spacing: 3px;
  color: #ffd166; text-transform: uppercase; margin-bottom: 3px; }
.epoch-desc { font-size: 12px; color: #b8a8c8; }

.pop-bar { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; margin-top: 8px; }
.pop-item { text-align: center; }
.pop-item .v { font-size: 24px; font-weight: 800; color: #ffd166; }
.pop-item .n { font-size: 10px; color: #b8a8c8; text-transform: uppercase; }
.pop-item.people .v { color: #60a5fa; }
.pop-item.food .v { color: #10b981; }

.timer-card {
  position: sticky; top: 10px; z-index: 50;
  text-align: center;
  background: rgba(20, 12, 35, 0.92);
  border: 1px solid rgba(255, 209, 102, 0.3);
  border-radius: 16px; padding: 18px; margin-bottom: 14px;
  backdrop-filter: blur(16px);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.35);
}
.timer .mode { font-size: 14px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; margin-bottom: 5px; color: #b8a8c8; }
.timer .mode.work { color: #ffd166; }
.timer .mode.rest { color: #60a5fa; }
.timer .time { font-size: 68px; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: 6px; color: #ffd166;
  text-shadow: 0 0 30px rgba(255, 209, 102, 0.4); }
.timer .label { font-size: 13px; color: #b8a8c8; margin: 6px 0 12px; }

.buttons { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
button.btn {
  font-family: inherit; font-size: 14px; font-weight: 600;
  padding: 11px 20px; border-radius: 10px; border: none;
  cursor: pointer; transition: all 0.15s;
}
button.btn:active { transform: scale(0.96); }
button.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-start { background: #fbbf24; color: #2a2410; }
.btn-start:hover:not(:disabled) { background: #fcd34d; }
.btn-pause { background: #94a3b8; color: #1a1a20; }
.btn-pause:hover:not(:disabled) { background: #cbd5e1; }
.btn-rest { background: #60a5fa; color: #0f1a2e; }
.btn-rest:hover:not(:disabled) { background: #93c5fd; }
.btn-done { background: #10b981; color: #0a1f18; }
.btn-done:hover:not(:disabled) { background: #34d399; }
.btn-reset { background: #64748b; color: #fff; }
.btn-reset:hover:not(:disabled) { background: #94a3b8; }

.res-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.res { background: rgba(0, 0, 0, 0.25); border-radius: 10px;
  padding: 10px 6px; text-align: center; border-top: 3px solid; }
.res.food { border-color: #10b981; }
.res.mat { border-color: #f59e0b; }
.res.energy { border-color: #60a5fa; }
.res.house { border-color: #a855f7; }
.res .v { font-size: 20px; font-weight: 700; }
.res.food .v { color: #10b981; }
.res.mat .v { color: #f59e0b; }
.res.energy .v { color: #60a5fa; }
.res.house .v { color: #a855f7; }
.res .n { font-size: 9px; color: #b8a8c8; text-transform: uppercase; }

.feed-list { max-height: 280px; overflow-y: auto; }
.feed-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.25); border-left: 3px solid #f59e0b;
  margin-bottom: 6px;
}
.feed-item .icon { font-size: 20px; }
.feed-item .day { font-size: 10px; color: #b8a8c8; min-width: 50px; }
.feed-item .text { font-size: 13px; color: #e8e0f0; flex: 1; }
.feed-item .text b { color: #ffd166; }
.feed-item .text small { display: block; font-size: 11px; color: #b8a8c8; font-style: italic; }

.empty { color: #8a7a9a; font-size: 13px; font-style: italic; text-align: center; padding: 10px; }

.checklist { list-style: none; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.checklist li { display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px;
  background: rgba(0, 0, 0, 0.25); font-size: 13px;
  cursor: pointer; color: #e8e0f0;
  border: 1px solid transparent; transition: all 0.15s;
}
.checklist li:hover { background: rgba(255, 209, 102, 0.1); }
.checklist li.done { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.checklist li .box { width: 18px; height: 18px; border-radius: 5px;
  border: 2px solid #4a4a56; display: flex;
  align-items: center; justify-content: center;
  font-size: 11px; flex-shrink: 0; }
.checklist li.done .box { background: #10b981; border-color: #10b981; color: #fff; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { background: rgba(0, 0, 0, 0.25); border-radius: 10px;
  padding: 10px 6px; text-align: center; border-top: 3px solid #ffd166; }
.stat .value { font-size: 22px; font-weight: 700; color: #ffd166; }
.stat .name { font-size: 10px; color: #b8a8c8; text-transform: uppercase; }

.toast { position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #ffd166; color: #2a2410;
  padding: 12px 24px; border-radius: 10px;
  font-weight: 600; font-size: 14px;
  opacity: 0; transition: all 0.3s;
  pointer-events: none; z-index: 100;
  max-width: 90vw; text-align: center; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

@media (max-width: 480px) {
  .timer .time { font-size: 52px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .res-grid { grid-template-columns: repeat(2, 1fr); }
  .rating-stats { gap: 8px; }
  .rating-stat { min-width: 32px; }
  .rating-stat .v { font-size: 12px; }
}
