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

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --error: #dc2626;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 8px;
}

html {
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 1rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

.nav-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  transition: background 0.2s;
}

.nav-link:hover {
  background: rgba(37, 99, 235, 0.1);
}

main {
  padding-bottom: 2rem;
}

.input-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text);
}

input[type="text"],
input[type="date"] {
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="date"]:focus {
  outline: none;
  border-color: var(--primary);
}

button {
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: white;
  background: var(--primary);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s;
  min-height: 56px;
}

button:hover {
  background: var(--primary-hover);
}

button:active {
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.feedback {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--radius);
  text-align: center;
  font-weight: 500;
}

.feedback.success {
  background: rgba(22, 163, 74, 0.1);
  color: var(--success);
}

.feedback.error {
  background: rgba(220, 38, 38, 0.1);
  color: var(--error);
}

.last-marker {
  margin-top: 2rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.last-marker p:first-child {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.marker-time {
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.marker-desc {
  color: var(--text);
}

.controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.date-picker {
  flex: 1;
  min-width: 200px;
}

.date-picker label {
  margin-bottom: 0.25rem;
}

.date-picker input {
  padding: 0.75rem;
}

.export-btn {
  flex-shrink: 0;
  width: auto;
  padding: 0.75rem 1.5rem;
  min-height: 44px;
  align-self: flex-end;
}

.current-date {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.error {
  padding: 1rem;
  background: rgba(220, 38, 38, 0.1);
  color: var(--error);
  border-radius: var(--radius);
  text-align: center;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state p {
  margin-bottom: 1rem;
}

.markers-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.markers-table th,
.markers-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.markers-table th {
  background: var(--bg);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.markers-table td:first-child {
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  white-space: nowrap;
  color: var(--primary);
  font-weight: 500;
}

.markers-table tr:last-child td {
  border-bottom: none;
}

.marker-count {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

@media (max-width: 480px) {
  .container {
    padding: 0.75rem;
  }

  header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  h1 {
    font-size: 1.25rem;
  }

  input[type="text"] {
    font-size: 1rem;
    padding: 0.875rem;
  }

  button {
    font-size: 1rem;
    padding: 0.875rem;
    min-height: 48px;
  }

  .controls {
    flex-direction: column;
  }

  .export-btn {
    width: 100%;
  }

  .markers-table th,
  .markers-table td {
    padding: 0.75rem;
  }

  .markers-table th:first-child,
  .markers-table td:first-child {
    width: 90px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
  }
}
