:root {
  --bg: #000;
  --fg: #fff;
  --border: #333;
  --accent: #007aff;
  --gray: #888;
  --nav-height: 60px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#app {
  min-height: 100vh;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
}

#view {
  padding: 16px;
  padding-bottom: 80px;
  -webkit-overflow-scrolling: touch;
}

#bottomNav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding-top: 8px;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--gray);
  text-decoration: none;
  flex: 1;
  padding: 8px;
  min-height: 44px;
  min-width: 44px;
}

.nav-item.active {
  color: var(--accent);
}

.nav-item .icon {
  font-size: 24px;
}

.nav-item .label {
  font-size: 10px;
}

.task-card {
  background: #111;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  cursor: pointer;
}

.task-card:active {
  background: #222;
}

.task-card h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.task-card p {
  font-size: 14px;
  color: var(--gray);
}

.task-detail {
  background: #111;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.task-detail h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.task-detail .meta {
  font-size: 12px;
  color: var(--gray);
  margin-bottom: 16px;
}

.task-detail .section {
  margin-bottom: 16px;
}

.task-detail .section h3 {
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--gray);
}

.task-detail .log-entry {
  background: #000;
  border-left: 2px solid var(--accent);
  padding: 8px;
  margin-bottom: 4px;
  font-size: 12px;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

.pane-card {
  background: #000;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 12px;
}

.pane-card h4 {
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--gray);
}

.pane-content {
  background: #111;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px;
  font-size: 11px;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 300px;
  white-space: pre;
  -webkit-overflow-scrolling: touch;
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

.login-container {
  width: 100%;
  max-width: 400px;
}

.login-container h1 {
  font-size: 24px;
  margin-bottom: 24px;
  text-align: center;
}

.login-container form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-container input {
  background: #111;
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 12px;
  font-size: 16px;
  border-radius: 8px;
  min-height: 44px;
}

.login-container button {
  background: var(--accent);
  color: var(--fg);
  border: none;
  padding: 12px;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 44px;
}

.login-container button:active {
  opacity: 0.8;
}

.error {
  color: #ff3b30;
  font-size: 14px;
  margin-top: 8px;
  min-height: 20px;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-event {
  background: #000;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.timeline-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  min-height: 44px;
  -webkit-tap-highlight-color: rgba(0, 122, 255, 0.2);
}

.timeline-header:active {
  background: #111;
}

.timeline-icon {
  font-size: 20px;
  width: 24px;
  text-align: center;
}

.timeline-type {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.timeline-ts {
  font-size: 11px;
  color: var(--gray);
}

.timeline-details {
  padding: 0 12px 12px 44px;
}

.timeline-details pre {
  background: #111;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px;
  font-size: 11px;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

input[type="checkbox"] {
  width: 44px;
  height: 26px;
  appearance: none;
  -webkit-appearance: none;
  background: #333;
  border-radius: 13px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s;
}

input[type="checkbox"]:checked {
  background: var(--accent);
}

input[type="checkbox"]::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  transition: left 0.3s;
}

input[type="checkbox"]:checked::before {
  left: 20px;
}

.markdown-content h1 { font-size: 24px; margin: 16px 0 8px; }
.markdown-content h2 { font-size: 20px; margin: 16px 0 8px; }
.markdown-content h3 { font-size: 18px; margin: 12px 0 8px; }
.markdown-content p { margin: 8px 0; line-height: 1.5; }
.markdown-content code { background: #111; padding: 2px 6px; border-radius: 4px; font-family: 'SF Mono', Monaco, monospace; font-size: 13px; }
.markdown-content pre { background: #111; border: 1px solid var(--border); border-radius: 4px; padding: 12px; overflow-x: auto; }
.markdown-content pre code { background: transparent; padding: 0; }
.markdown-content ul, .markdown-content ol { margin: 8px 0; padding-left: 24px; }
.markdown-content li { margin: 4px 0; }
.markdown-content blockquote { border-left: 4px solid var(--accent); padding-left: 12px; margin: 12px 0; color: var(--gray); }
.markdown-content table { border-collapse: collapse; width: 100%; margin: 12px 0; }
.markdown-content th, .markdown-content td { border: 1px solid var(--border); padding: 8px; text-align: left; }
.markdown-content th { background: #111; }

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
  }
}
