/* ===== reset & base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

@font-face {
  font-family: "Digital-7";
  src: url("Digital-7 V7.woff2") format("woff2");
  font-display: swap;
}

:root {
  --bg: #000000;
  --surface: #080808;
  --border: #1c1c1c;
  --text: #b0a8a0;
  --text-dim: #7a7a7a;
  --accent: #d08848;
  --accent-done: #6a8a5a;
  --danger: #f85149;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "SF Mono", "Cascadia Code", "Menlo", "Noto Sans SC", monospace;
  overflow: hidden;
}

/* ===== layout ===== */
.layout {
  display: flex;
  height: 100%;
}

/* ===== clock ===== */
.clock-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-width: 0;
  overflow: hidden;
  container-type: inline-size;
  transition: transform 2s ease;
}

.clock {
  position: relative;
  font-family: "Digital-7", monospace;
  font-size: clamp(3rem, 18cqi, 9rem);
  font-weight: 400;
  color: #f09040;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  text-shadow:
    0 0 4px #f09040,
    0 0 12px #f09040,
    0 0 30px rgba(240, 144, 64, 0.4),
    0 0 60px rgba(240, 144, 64, 0.15);
}

.clock::before {
  content: "88:88:88";
  position: absolute;
  top: 0;
  left: 0;
  color: rgba(255, 255, 255, 0.1);
  text-shadow: none;
  pointer-events: none;
}

.clock.compact {
  font-size: clamp(4.5rem, 26cqi, 12rem);
}

.clock.compact::before {
  content: "88:88";
}

.clock-colon {
  animation: colon-blink 1s step-end infinite;
}

.clock-colon.still {
  animation: none;
}

@keyframes colon-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

.date {
  font-family: "Digital-7", monospace;
  font-size: clamp(1rem, 5cqi, 1.8rem);
  color: #c8a070;
  white-space: nowrap;
  text-shadow:
    0 0 3px #9a7a5a,
    0 0 8px rgba(154, 122, 90, 0.5),
    0 0 20px rgba(154, 122, 90, 0.2);
}

/* ===== todo panel ===== */
.todo-panel {
  width: 360px;
  max-width: 42vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.todo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 12px;
}

.todo-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
}

.btn-add {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.btn-add:active { background: var(--border); }

/* ===== todo list ===== */
.todo-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 0 16px;
  min-height: 0;
}

.todo-list.done-list {
  flex: none;
  max-height: 35%;
}

.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}

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

.todo-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  margin-top: 2px;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}

.todo-item input[type="checkbox"]:checked {
  border-color: var(--accent);
}

.todo-item input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  width: 7px;
  height: 12px;
  border: solid var(--accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.todo-item input[type="checkbox"]:not(:checked) {
  opacity: 0.45;
}

.todo-body {
  flex: 1;
  min-width: 0;
}

.todo-text {
  font-size: 1rem;
  color: #8e8e8e;
  word-break: break-all;
}

.todo-meta {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.todo-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.btn-edit, .btn-del {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-edit:active, .btn-del:active { background: var(--border); }
.btn-del:active { color: var(--danger); }

/* ===== done items ===== */
.todo-item.done .todo-text {
  text-decoration: line-through;
  color: var(--text-dim);
}

/* ===== divider ===== */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
  user-select: none;
}
.divider:hover { color: var(--text); }
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.done-list.collapsed {
  display: none;
}

/* ===== modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 400px;
}

.modal h3 {
  margin-bottom: 16px;
  font-size: 1.1rem;
}

.modal input {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  outline: none;
}
.modal input:focus { border-color: var(--accent); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.btn-cancel, .btn-save {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid var(--border);
}

.btn-cancel {
  background: transparent;
  color: var(--text-dim);
}

.btn-save {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ===== scrollbar ===== */
.todo-list::-webkit-scrollbar { width: 4px; }
.todo-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ===== mobile ===== */
@media (max-width: 640px) {
  .layout { flex-direction: column; }
  .clock-area { flex: none; padding: 24px 16px 8px; }
  .clock { font-size: clamp(2.5rem, 16vw, 6rem); }
  .clock.compact { font-size: clamp(3.5rem, 22vw, 8rem); }
  .todo-panel {
    width: 100%;
    max-width: 100%;
    flex: 1;
    border-left: none;
    border-top: 1px solid var(--border);
  }
}

/* ===== toast ===== */
.toast {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--danger);
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 200;
  pointer-events: none;
}

/* ===== landscape phone ===== */
@media (max-height: 500px) {
  .todo-panel { max-width: 35vw; }

  .todo-header { padding: 10px 14px 6px; }
  .todo-header h2 { font-size: 1rem; }
  .btn-add { width: 32px; height: 32px; font-size: 1.2rem; }

  .todo-list { padding: 0 12px; }
  .todo-item { padding: 6px 4px; gap: 8px; }
  .todo-item input[type="checkbox"] { width: 20px; height: 20px; }
  .todo-item input[type="checkbox"]:checked::after {
    left: 5px;
    top: 2px;
    width: 6px;
    height: 10px;
  }
  .todo-text { font-size: 0.85rem; }
  .todo-meta { display: none; }

  .todo-actions { gap: 2px; }
  .btn-edit, .btn-del { width: 28px; height: 28px; font-size: 0.75rem; }

  .divider { padding: 6px 14px; font-size: 0.7rem; }
}
