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

:root {
  --primary: #ba4949;
  --primary-short: #38858a;
  --primary-long: #397097;
  --white: #fff;
  --semi-white: rgba(255, 255, 255, 0.15);
  --semi-white-hover: rgba(255, 255, 255, 0.25);
  --card-bg: rgba(255, 255, 255, 0.12);
  --card-bg-dark: rgba(0, 0, 0, 0.15);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--primary);
  color: var(--white);
  min-height: 100vh;
  transition: background-color 0.3s ease;
}

body.mode-short {
  background-color: var(--primary-short);
}

body.mode-long {
  background-color: var(--primary-long);
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  max-width: 620px;
  margin: 0 auto;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 28px;
  height: 28px;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
}

.header-buttons {
  display: flex;
  gap: 8px;
}

.header-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--semi-white);
  border: none;
  border-radius: 8px;
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.header-btn:hover {
  background: var(--semi-white-hover);
}

.header-btn svg {
  width: 18px;
  height: 18px;
}

.header-btn.icon-only {
  padding: 8px 10px;
}

.header-btn.icon-only svg {
  width: 20px;
  height: 20px;
}

/* Main Content */
.main {
  max-width: 620px;
  margin: 0 auto;
  padding: 40px 24px;
}

/* Timer Card */
.timer-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 32px 40px;
  margin-bottom: 24px;
}

.mode-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 32px;
}

.mode-tab {
  flex: 1;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--white);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.mode-tab:hover {
  background: var(--semi-white);
}

.mode-tab.active {
  background: var(--card-bg-dark);
}

.timer-display {
  text-align: center;
  margin-bottom: 32px;
}

#timer {
  font-size: 7rem;
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1;
}

.start-btn {
  width: 100%;
  padding: 18px 24px;
  background: var(--white);
  border: none;
  border-radius: 8px;
  color: var(--primary);
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

body.mode-short .start-btn {
  color: var(--primary-short);
}

body.mode-long .start-btn {
  color: var(--primary-long);
}

.start-btn:hover {
  opacity: 0.95;
}

.start-btn:active {
  transform: scale(0.99);
}

.start-btn.running {
  color: var(--primary);
}

body.mode-short .start-btn.running {
  color: var(--primary-short);
}

body.mode-long .start-btn.running {
  color: var(--primary-long);
}

/* Status */
.status {
  text-align: center;
  margin-bottom: 32px;
}

#sessionNum {
  display: block;
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 4px;
}

#statusText {
  display: block;
  font-size: 0.95rem;
  opacity: 0.9;
}

/* Tasks Section */
.tasks-section {
  margin-top: 32px;
}

.tasks-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.tasks-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.tasks-menu-btn {
  padding: 6px 8px;
  background: var(--semi-white);
  border: none;
  border-radius: 6px;
  color: var(--white);
  cursor: pointer;
  transition: background 0.2s;
}

.tasks-menu-btn:hover {
  background: var(--semi-white-hover);
}

.tasks-menu-btn svg {
  width: 20px;
  height: 20px;
}

.tasks-divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 16px;
}

.add-task-btn {
  width: 100%;
  padding: 16px 24px;
  background: transparent;
  border: 2px dashed rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  color: var(--white);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: border-color 0.2s, background 0.2s;
}

.add-task-btn:hover {
  border-color: rgba(255, 255, 255, 0.6);
  background: var(--semi-white);
}

.add-icon {
  font-size: 1.25rem;
  font-weight: 400;
}

/* Task List */
.task-list {
  list-style: none;
  margin-top: 12px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--semi-white);
  border-radius: 8px;
  margin-bottom: 8px;
}

.task-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
}

.task-item .task-text {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--white);
  font-size: 1rem;
  outline: none;
}

.task-item .task-text::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.task-item.completed .task-text {
  text-decoration: line-through;
  opacity: 0.6;
}

.task-item .task-delete {
  padding: 4px;
  background: transparent;
  border: none;
  color: var(--white);
  opacity: 0.7;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.task-item .task-delete:hover {
  opacity: 1;
}

/* Modal Overlay */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 12px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  color: #333;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  color: #999;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.modal-close:hover {
  color: #333;
}

/* Report Modal */
.report-modal {
  padding: 24px 32px 32px;
}

.report-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid #eee;
}

.report-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #999;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.2s;
}

.report-tab:hover {
  color: #666;
}

.report-tab.active {
  color: #e85d5d;
  border-bottom-color: #e85d5d;
}

.report-tab svg {
  width: 18px;
  height: 18px;
}

.report-content {
  min-height: 200px;
}

.report-content.hidden {
  display: none;
}

.report-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: #333;
}

.report-login-msg {
  font-size: 0.9rem;
  color: #999;
  margin-bottom: 20px;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  background: #fef2f2;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.stat-card svg {
  width: 24px;
  height: 24px;
  color: #e85d5d;
  margin-bottom: 8px;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: #e85d5d;
}

.stat-label {
  font-size: 0.8rem;
  color: #e85d5d;
}

.focus-time-toggles {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.focus-toggle {
  padding: 8px 16px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #666;
  cursor: pointer;
}

.focus-toggle:hover {
  background: #eee;
}

.focus-toggle.active {
  background: #fff;
  border-color: #333;
  color: #333;
}

.focus-toggle .lock-icon {
  width: 12px;
  height: 12px;
  display: inline-block;
  vertical-align: middle;
  margin-left: 4px;
}

.focus-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}

.focus-nav-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  color: #666;
}

.focus-nav-btn:hover {
  background: #f5f5f5;
}

.focus-period {
  font-size: 0.95rem;
  font-weight: 500;
}

.chart-placeholder {
  background: #fafafa;
  border-radius: 8px;
  padding: 24px;
  min-height: 120px;
}

.chart-area {
  height: 80px;
  background: linear-gradient(to top, rgba(232, 93, 93, 0.1) 0%, transparent 100%);
  border-radius: 4px;
  margin-top: 12px;
}

.detail-table-wrapper {
  overflow-x: auto;
  margin-bottom: 16px;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.detail-table th {
  text-align: left;
  padding: 12px;
  border-bottom: 2px solid #eee;
  color: #999;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.detail-table td {
  padding: 12px;
  border-bottom: 1px solid #eee;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.page-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  font-size: 1rem;
  cursor: pointer;
  color: #666;
}

.page-btn:hover {
  background: #f5f5f5;
}

.page-num {
  font-size: 0.95rem;
}

/* Settings Modal */
.settings-modal {
  padding: 24px 32px 32px;
}

.modal-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  margin-bottom: 24px;
}

.settings-section {
  margin-bottom: 28px;
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.settings-section-title svg {
  width: 18px;
  height: 18px;
  color: #666;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

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

.settings-row label {
  font-size: 0.95rem;
  color: #333;
}

.info-icon {
  color: #999;
  font-size: 0.85rem;
  cursor: help;
}

.time-inputs {
  display: flex;
  gap: 12px;
}

.time-input-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.time-input-group input {
  width: 56px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  text-align: center;
}

.time-input-group span {
  font-size: 0.75rem;
  color: #999;
}

.small-input {
  width: 56px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  text-align: center;
}

.settings-row select {
  padding: 8px 32px 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  background: #fff;
  cursor: pointer;
}

/* Toggle Switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #ddd;
  border-radius: 24px;
  transition: 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle input:checked + .toggle-slider {
  background: #4ade80;
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* Responsive */
@media (max-width: 480px) {
  #timer {
    font-size: 5rem;
  }

  .timer-card {
    padding: 24px 20px;
  }

  .mode-tab {
    font-size: 0.9rem;
    padding: 10px 8px;
  }

  .stat-cards {
    grid-template-columns: 1fr;
  }

  .time-inputs {
    flex-direction: column;
  }
}
