:root {
  --bg: #f6f0e8;
  --card: #fffdf9;
  --text: #2f2a25;
  --muted: #7b7168;
  --line: #e9ded1;
  --primary: #6f8f72;
  --primary-dark: #58755a;
  --accent: #d98b5f;
  --shadow: 0 18px 45px rgba(84, 66, 47, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(217, 139, 95, 0.18), transparent 32rem),
    var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}

a {
  color: var(--primary-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.35rem;
  font-size: clamp(2rem, 6vw, 3rem);
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 0.5rem;
  font-size: 1.35rem;
}

.page {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

.card {
  padding: 1.5rem;
  background: rgba(255, 253, 249, 0.92);
  border: 1px solid rgba(233, 222, 209, 0.8);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.login-card {
  max-width: 460px;
  margin: 12vh auto 0;
}

.hero {
  margin-bottom: 1.5rem;
}

.auth-switch {
  margin: 1rem 0 0;
  text-align: center;
}

.eyebrow {
  margin-bottom: 0.4rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.alert {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  color: #8a3724;
  background: #fff0ea;
  border: 1px solid #f4c8b8;
  border-radius: 16px;
}

.form {
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.4rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  font: inherit;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(111, 143, 114, 0.18);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button:disabled:hover {
  transform: none;
}

.primary {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 10px 24px rgba(111, 143, 114, 0.28);
}

.primary:hover {
  background: var(--primary-dark);
}

.secondary,
.ghost {
  color: var(--text);
  background: #fff8ef;
  border: 1px solid var(--line);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.status-card {
  margin-bottom: 1rem;
}

.status-heading,
.section-title,
.friend-row,
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.dot {
  display: inline-block;
  width: 0.72rem;
  height: 0.72rem;
  margin-right: 0.5rem;
  background: #c9bfb4;
  border-radius: 999px;
}

.dot.active {
  background: #4f9f64;
  box-shadow: 0 0 0 6px rgba(79, 159, 100, 0.14);
}

.total {
  min-width: 9rem;
  padding: 0.9rem 1rem;
  text-align: right;
  background: #f7efe5;
  border-radius: 18px;
}

.total span,
.total strong {
  display: block;
}

.total span {
  color: var(--muted);
  font-size: 0.85rem;
}

.total strong,
.friend-time,
.history-duration {
  font-size: 1.05rem;
  font-weight: 800;
}

.work-now {
  margin-top: 1rem;
}

.end-form {
  margin-top: 1rem;
}

.home-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.home-main {
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 1rem;
}

.friends-card {
  padding: 1.25rem;
}

.sidebar .section-title,
.sidebar .friend-row {
  align-items: stretch;
  flex-direction: column;
}

.sidebar .friend-time {
  text-align: left;
}

.grid {
  display: grid;
  gap: 1rem;
}

.timer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.timer-card {
  display: grid;
  gap: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.timer-card.is-running {
  border-color: rgba(111, 143, 114, 0.55);
  box-shadow: 0 18px 45px rgba(84, 66, 47, 0.12), 0 0 0 5px rgba(111, 143, 114, 0.12);
}

.timer-display {
  padding: 1.15rem;
  text-align: center;
  background: #f7efe5;
  border: 1px solid var(--line);
  border-radius: 22px;
  font-size: clamp(2.6rem, 9vw, 4.2rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.06em;
}

.timer-card.is-running .timer-display {
  animation: timerPulse 1s ease-in-out infinite;
}

.timer-detail {
  margin: -0.4rem 0 0;
  color: var(--primary-dark);
  text-align: center;
  font-size: 1.05rem;
  font-weight: 800;
}

.timer-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.timer-settings.single {
  grid-template-columns: 1fr;
}

.timer-settings input {
  text-align: center;
}

.timer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.timer-actions .button {
  flex: 1 1 6rem;
}

.timer-hint {
  margin-bottom: 0;
  font-size: 0.92rem;
}

.task-card {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
  scroll-margin-top: 1rem;
}

.task-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
}

.task-actions,
.drawn-task-actions,
.task-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.task-notice {
  padding: 0.8rem 1rem;
  color: var(--primary-dark);
  background: #eef6ef;
  border: 1px solid #cfe2d1;
  border-radius: 16px;
}

.drawn-task {
  display: grid;
  gap: 0.55rem;
  padding: 1rem;
  background: #f3f7ed;
  border: 1px solid #cfe2d1;
  border-radius: 18px;
}

.drawn-task strong {
  font-size: 1.3rem;
}

.task-list {
  display: grid;
  gap: 0.75rem;
}

.task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  background: #fffaf3;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.task-item p {
  margin: 0.2rem 0 0;
}

.task-item.is-done strong {
  color: var(--muted);
  text-decoration: line-through;
}

.button.small {
  min-height: 2.25rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.92rem;
}

@keyframes timerPulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.015);
  }
}

.friend-list,
.history-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.friend-row,
.history-item {
  padding: 1rem;
  background: #fffaf3;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.friend-row p,
.history-item p {
  margin: 0.2rem 0 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  margin-right: 0.35rem;
  padding: 0.18rem 0.55rem;
  color: var(--muted);
  background: #eee5da;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
}

.badge.working {
  color: #2f6f40;
  background: #e6f3e8;
}

.note {
  color: var(--muted);
}

.empty {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .home-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 640px) {
  .page {
    padding-top: 1rem;
  }

  .timer-grid,
  .timer-settings,
  .task-form {
    grid-template-columns: 1fr;
  }

  .topbar,
  .status-heading,
  .section-title,
  .task-item,
  .friend-row,
  .history-item {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar .button,
  .section-title a {
    align-self: flex-start;
  }

  .total,
  .friend-time,
  .history-duration {
    text-align: left;
  }
}
