:root {
  --bg: #0f1115;
  --surface: #1a1d24;
  --surface-2: #232732;
  --border: #2d323e;
  --text: #e7e9ee;
  --text-dim: #9aa0ad;
  --accent: #5ac8fa;
  --accent-strong: #2ea7e0;
  --done: #34c759;
  --done-dim: #1e6b34;
  --danger: #ff6b6b;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 16px rgba(0,0,0,0.35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  min-height: 100%;
}

.app {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.app-header {
  text-align: center;
  margin-bottom: 28px;
}

.app-header h1 {
  margin: 0 0 6px;
  font-size: 2rem;
  letter-spacing: 0.5px;
}

.subtitle {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.add-habit {
  margin-bottom: 24px;
}

.habit-form {
  display: flex;
  gap: 10px;
  background: var(--surface);
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.habit-form input[type="text"] {
  flex: 1;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
}

.habit-form input[type="text"]:focus {
  border-color: var(--accent);
}

.habit-form button {
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #08222e;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.habit-form button:hover {
  background: var(--accent-strong);
  color: #fff;
}

.habits {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.habits-header,
.habit-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.6fr) auto 70px 44px;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
}

.habits-header {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.col-days {
  display: grid;
  grid-template-columns: repeat(7, 36px);
  gap: 6px;
  justify-content: center;
}

.day-label {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-dim);
}

.col-streak {
  text-align: center;
}

.col-actions {
  text-align: right;
}

.habit-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.habit-row {
  border-bottom: 1px solid var(--border);
}

.habit-row:last-child {
  border-bottom: none;
}

.habit-name {
  font-weight: 500;
  word-break: break-word;
}

.day-cell {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  padding: 0;
  transition: transform 0.08s, background 0.15s, border-color 0.15s;
}

.day-cell:hover {
  border-color: var(--accent);
}

.day-cell:active {
  transform: scale(0.94);
}

.day-cell.done {
  background: var(--done);
  border-color: var(--done);
  color: #06210e;
  font-weight: 700;
}

.day-cell.today {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.streak {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  color: var(--accent);
}

.streak.zero {
  color: var(--text-dim);
  font-weight: 500;
}

.delete-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.delete-btn:hover {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.empty-state {
  margin: 0;
  padding: 28px 16px;
  text-align: center;
  color: var(--text-dim);
}

.app-footer {
  margin-top: 24px;
  text-align: center;
  color: var(--text-dim);
}

@media (max-width: 720px) {
  .habits-header {
    display: none;
  }

  .habit-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name actions"
      "days days"
      "streak streak";
    row-gap: 10px;
  }

  .habit-name { grid-area: name; }
  .col-actions { grid-area: actions; }
  .col-days { grid-area: days; justify-content: start; }
  .col-streak { grid-area: streak; text-align: left; }
}
