:root {
  --theme-color: #ba4949;
  --btn-shadow: #ebebeb;
}
body[data-mode="pomodoro"]   { --theme-color: #ba4949; }
body[data-mode="shortBreak"] { --theme-color: #38858a; }
body[data-mode="longBreak"]  { --theme-color: #397097; }

* { margin: 0; padding: 0; box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  font-family: 'Varela Round', 'Arial Rounded MT Bold', Arial, sans-serif;
  background-color: var(--theme-color);
  transition: background-color 0.5s ease-in-out;
  color: #fff;
  min-height: 100vh;
}

button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

.app { display: flex; flex-direction: column; min-height: 100vh; }

/* ---------- Header ---------- */
.header { width: 100%; }
.header-inner {
  max-width: 620px;
  margin: 0 auto;
  padding: 14px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex; align-items: center; gap: 6px;
  color: #fff; text-decoration: none;
  font-size: 20px; font-weight: bold;
}
.logo-check { transition: stroke 0.5s ease-in-out; }
.header-btns { display: flex; gap: 10px; }
.header-btn {
  display: flex; align-items: center; gap: 5px;
  background: rgba(255, 255, 255, 0.2);
  border: none; border-radius: 4px;
  color: #fff; font-size: 13px;
  padding: 8px 12px;
  opacity: 0.9;
}
.header-btn:hover { opacity: 1; }
.header-btn:active { transform: translateY(2px); }

.progress-track {
  max-width: 620px; margin: 0 auto;
  height: 1px; background: rgba(0, 0, 0, 0.1);
  position: relative;
}
.progress-bar {
  position: absolute; top: -1px; left: 0;
  height: 3px; width: 0%;
  background: #fff; border-radius: 3px;
  transition: width 0.3s linear;
}

/* ---------- Main / timer ---------- */
.main {
  flex: 1;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  padding: 0 12px 60px;
}

.timer-card {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  margin-top: 30px;
  padding: 20px 0 30px;
  text-align: center;
}

.mode-tabs { display: flex; justify-content: center; gap: 4px; }
.mode-tab {
  background: none; border: none;
  color: #fff; font-size: 16px;
  padding: 4px 12px; border-radius: 4px;
  height: 28px;
}
.mode-tab.active { background: rgba(0, 0, 0, 0.15); font-weight: bold; }

.time {
  font-size: 120px;
  font-weight: bold;
  margin: 20px 0;
  line-height: 1.1;
  user-select: none;
}

.timer-controls { position: relative; display: flex; justify-content: center; align-items: center; }
.start-btn {
  width: 200px; height: 55px;
  background: #fff;
  color: var(--theme-color);
  border: none; border-radius: 4px;
  font-size: 22px; font-weight: bold;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 6px 0 var(--btn-shadow);
  transition: color 0.5s ease-in-out;
}
.start-btn.running {
  transform: translateY(6px);
  box-shadow: none;
}
.skip-btn {
  position: absolute;
  right: 30px;
  background: none; border: none;
  color: #fff; opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.skip-btn.visible { opacity: 0.9; pointer-events: auto; }
.skip-btn:hover { opacity: 1; }

.session-info { text-align: center; margin-top: 22px; }
.pomo-count { opacity: 0.6; font-size: 16px; }
.session-message { font-size: 16px; margin-top: 6px; }

/* ---------- Tasks ---------- */
.tasks { margin-top: 24px; }
.tasks-header {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 2px solid rgba(255, 255, 255, 0.5);
  padding-bottom: 12px;
}
.tasks-header h2 { font-size: 18px; }
.tasks-menu-wrap { position: relative; }
.tasks-menu-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none; border-radius: 4px;
  color: #fff; padding: 5px 6px 3px;
}
.tasks-menu-btn:hover { background: rgba(255, 255, 255, 0.3); }
.tasks-menu {
  position: absolute; right: 0; top: 36px;
  background: #fff; color: #4d4d4d;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  min-width: 210px;
  z-index: 20;
  overflow: hidden;
}
.tasks-menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  background: none; border: none;
  padding: 12px 14px;
  font-size: 14px; color: #4d4d4d;
  text-align: left;
}
.tasks-menu-item:hover { background: #f2f2f2; }
.tasks-menu-item + .tasks-menu-item { border-top: 1px solid #eee; }

.task-list { list-style: none; margin-top: 14px; }
.task-item {
  display: flex; align-items: center;
  background: #fff; color: #555;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 8px;
  border-left: 6px solid transparent;
  cursor: pointer;
}
.task-item:hover { border-left-color: #dfdfdf; }
.task-item.selected { border-left-color: #222; }
.task-check {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border: none; border-radius: 50%;
  background: #dfdfdf;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  margin-right: 10px;
}
.task-item.done .task-check { background: var(--theme-color); }
.task-name { flex: 1; font-weight: bold; font-size: 15px; word-break: break-word; }
.task-item.done .task-name { text-decoration: line-through; color: #bbb; }
.task-acts { font-size: 14px; color: #aaa; font-weight: bold; margin: 0 10px; white-space: nowrap; }
.task-acts b { font-size: 16px; color: #999; }
.task-edit {
  background: none; border: 1px solid #dfdfdf; border-radius: 4px;
  color: #999; padding: 4px 5px 2px;
}
.task-edit:hover { background: #f5f5f5; }

.add-task-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%;
  margin-top: 14px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.1);
  border: 2px dashed rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  color: #fff; font-weight: bold; font-size: 15px;
  opacity: 0.8;
}
.add-task-btn:hover { opacity: 1; }

/* ---------- Task form ---------- */
.task-form {
  background: #fff;
  border-radius: 8px;
  margin-top: 14px;
  padding: 18px 14px 0;
  overflow: hidden;
}
.task-input {
  width: 100%;
  border: none; outline: none;
  font-size: 20px; font-weight: bold;
  color: #555;
}
.task-input::placeholder { color: #ccc; font-style: italic; }
.est-block { margin-top: 20px; padding-bottom: 18px; }
.est-block label { display: block; font-weight: bold; color: #555; font-size: 14px; margin-bottom: 8px; }
.est-controls { display: flex; align-items: center; gap: 6px; }
.est-controls input {
  width: 70px;
  background: #efefef;
  border: none; border-radius: 4px;
  padding: 8px 10px;
  font-size: 15px; font-weight: bold; color: #555;
}
.est-step {
  background: #fff;
  border: 1px solid #dfdfdf; border-radius: 4px;
  color: #555;
  padding: 8px 10px 6px;
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.05);
}
.est-step:active { transform: translateY(1px); }
.task-form-footer {
  background: #efefef;
  margin: 0 -14px;
  padding: 12px 14px;
  display: flex; justify-content: flex-end; gap: 10px;
}
.form-btn {
  border: none; border-radius: 4px;
  padding: 9px 20px;
  font-size: 14px; font-weight: bold;
}
.form-btn.cancel { background: none; color: #888; }
.form-btn.save { background: #222; color: #fff; }
.form-btn.save:active { transform: translateY(1px); }

.summary-bar {
  display: flex; justify-content: center; gap: 26px;
  background: rgba(0, 0, 0, 0.1);
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  margin-top: 16px;
  padding: 16px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}
.summary-bar b { color: #fff; font-size: 16px; }

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex; justify-content: center; align-items: flex-start;
  padding: 48px 12px;
  z-index: 50;
  overflow-y: auto;
}
.modal {
  background: #fff; color: #555;
  border-radius: 8px;
  width: 100%; max-width: 400px;
  overflow: hidden;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
  color: #aaa; font-weight: bold; font-size: 14px; letter-spacing: 1px;
}
.modal-close { background: none; border: none; color: #ccc; font-size: 16px; }
.modal-close:hover { color: #999; }
.modal-body { padding: 6px 20px 20px; }

.setting-group-label {
  display: flex; align-items: center; gap: 8px;
  color: #bbb; font-weight: bold; font-size: 14px; letter-spacing: 1px;
  padding: 18px 0 6px;
}
.setting-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #f3f3f3;
}
.setting-row.column { flex-direction: column; align-items: stretch; gap: 10px; }
.setting-label { font-weight: bold; color: #555; font-size: 15px; }
.time-inputs { display: flex; gap: 12px; }
.time-input { flex: 1; }
.time-input label { display: block; font-size: 13px; color: #aaa; font-weight: bold; margin-bottom: 6px; }
.time-input input, .small-number {
  width: 100%;
  background: #efefef;
  border: none; border-radius: 4px;
  padding: 10px;
  font-size: 15px; font-weight: bold; color: #555;
  outline: none;
}
.small-number { width: 70px; }
select {
  background: #efefef;
  border: none; border-radius: 4px;
  padding: 10px 14px;
  font-size: 14px; font-weight: bold; color: #555;
  outline: none;
}
.volume-wrap { display: flex; align-items: center; gap: 10px; width: 60%; }
.volume-wrap span { font-weight: bold; min-width: 28px; text-align: right; }
.volume-wrap input[type="range"] { flex: 1; accent-color: #555; }

.toggle { position: relative; display: inline-block; width: 60px; height: 30px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #ccc;
  border-radius: 30px;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  width: 24px; height: 24px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.toggle input:checked + .toggle-slider { background: #84c982; }
.toggle input:checked + .toggle-slider::before { transform: translateX(30px); }

.modal-footer {
  background: #efefef;
  padding: 12px 20px;
  display: flex; justify-content: flex-end;
}

.wide-text {
  width: 100%;
  background: #efefef;
  border: none; border-radius: 4px;
  padding: 10px;
  font-size: 14px; color: #555;
  outline: none;
}

/* ---------- Project ---------- */
.project-block { margin-top: 18px; }
.project-block label { display: block; font-weight: bold; color: #555; font-size: 14px; margin-bottom: 8px; }
.project-block select { min-width: 180px; }
.task-project-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: bold; color: #999;
  background: #f5f5f5;
  border-radius: 10px;
  padding: 3px 9px;
  margin-right: 8px;
  white-space: nowrap;
}
.project-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* ---------- Templates ---------- */
.template-list { list-style: none; margin-top: 12px; }
.template-item {
  display: flex; align-items: center; gap: 10px;
  background: #f7f7f7;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.template-name { flex: 1; font-weight: bold; color: #555; font-size: 15px; }
.template-count { font-size: 13px; color: #aaa; white-space: nowrap; }
.template-add {
  background: #222; color: #fff;
  border: none; border-radius: 4px;
  padding: 7px 14px;
  font-size: 13px; font-weight: bold;
}
.template-delete {
  background: none; border: none;
  color: #ccc; font-size: 15px;
  padding: 4px 6px;
}
.template-delete:hover { color: #ba4949; }
.template-empty { color: #aaa; text-align: center; padding: 24px 0; }

/* ---------- Report ---------- */
.report-tabs {
  display: flex; gap: 6px;
  margin-top: 14px;
}
.report-tab {
  flex: 1;
  background: #efefef;
  border: none; border-radius: 4px;
  color: #888; font-size: 14px; font-weight: bold;
  padding: 9px 0;
}
.report-tab.active {
  background: var(--theme-color);
  color: #fff;
  transition: background-color 0.5s ease-in-out;
}
.report-projects-title {
  color: #bbb; font-weight: bold; font-size: 13px; letter-spacing: 1px;
  margin-top: 20px;
  border-top: 1px solid #f0f0f0;
  padding-top: 14px;
}
.report-project-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  font-size: 14px; color: #555;
  border-bottom: 1px solid #f7f7f7;
}
.report-project-row .report-project-name { flex: 1; font-weight: bold; }
.report-project-row .report-project-time { color: #999; font-weight: bold; }
.export-btn {
  display: flex; align-items: center; gap: 7px;
  margin: 18px auto 0;
}
.report-summary {
  display: flex; gap: 10px;
  margin-top: 14px;
}
.report-stat {
  flex: 1;
  background: var(--theme-color);
  color: #fff;
  border-radius: 8px;
  padding: 16px 8px;
  text-align: center;
  transition: background-color 0.5s ease-in-out;
}
.report-num { font-size: 22px; font-weight: bold; }
.report-label { font-size: 12px; opacity: 0.85; margin-top: 4px; }
.report-chart { margin-top: 18px; }
.report-day {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: #888;
  padding: 4px 0;
}
.report-day-label { width: 82px; }
.report-day-bar {
  height: 14px;
  background: var(--theme-color);
  border-radius: 3px;
  transition: background-color 0.5s ease-in-out;
  min-width: 2px;
}
.report-day-val { font-weight: bold; color: #555; }
.report-empty { color: #aaa; text-align: center; padding: 20px 0; }

/* ---------- Footer ---------- */
.footer {
  background: rgba(0, 0, 0, 0.1);
  margin-top: 40px;
  padding: 40px 12px 60px;
}
.footer > * { max-width: 620px; margin-left: auto; margin-right: auto; }
.footer h3 { font-size: 20px; margin-bottom: 24px; text-align: center; }
.footer-section { margin-bottom: 26px; }
.footer-section h4 { font-size: 17px; margin-bottom: 8px; }
.footer-section p, .footer-section li { font-size: 14px; line-height: 1.7; color: rgba(255, 255, 255, 0.85); }
.footer-section ol, .footer-section ul { padding-left: 22px; }
.footer-section a { color: #fff; }
.copyright { text-align: center; font-size: 13px; opacity: 0.6; margin-top: 30px; }

@media (max-width: 480px) {
  .time { font-size: 78px; }
  .header-btn-label { display: none; }
  .skip-btn { right: 6px; }
}
