/* kanpe-app v1 — ダーク背景・高コントラスト・装飾最小限（SPEC §5.5） */

:root {
  color-scheme: dark;
  --bg: #0b0b0d;
  --surface: #1b1b1f;
  --surface-hover: #26262c;
  --text: #f5f5f7;
  --text-dim: #a3a3ad;
  --accent: #4da3ff;
  --danger: #ff5c5c;
  --border: #333338;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  font-size: 20px;
  line-height: 1.6;
}

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

.screen[hidden] {
  display: none;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg, #12141a);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.app-title {
  font-size: 1.1em;
  margin: 0;
  flex: 1;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.4em;
  padding: 4px 8px;
  cursor: pointer;
}

.progress {
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

.error-banner {
  background: var(--danger);
  color: #1a0000;
  padding: 12px 16px;
  font-weight: bold;
}

.script-list-wrap {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.script-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.script-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.script-item:hover,
.script-item:focus-within {
  background: var(--surface-hover);
}

.script-main {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 0;
  font-size: 1em;
  cursor: pointer;
}

.script-title {
  display: block;
  font-weight: bold;
  font-size: 1.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.script-meta {
  display: block;
  color: var(--text-dim);
  font-size: 0.8em;
  margin-top: 4px;
}

.delete-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--danger);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85em;
  cursor: pointer;
  flex-shrink: 0;
}

.empty-message {
  color: var(--text-dim);
  text-align: center;
  margin-top: 40px;
}

.bottom-bar {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.primary-btn {
  width: 100%;
  padding: 16px;
  font-size: 1em;
  font-weight: bold;
  background: var(--accent);
  color: #071120;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

.mode-toggle-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.8em;
  cursor: pointer;
  flex-shrink: 0;
}

.viewer-content {
  flex: 1;
  overflow-y: auto;
}

/* カードモード（SPEC §5.3） */
.viewer-content.card-mode {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  touch-action: pan-y;
}

.card {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-heading,
.sheet-heading {
  font-size: 1.3em;
  margin: 0;
}

.card-body p,
.sheet-body p {
  margin: 0 0 1em;
}

.card-body ul,
.sheet-body ul {
  margin: 0 0 1em;
  padding-left: 1.4em;
}

.check-btn {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.95em;
  cursor: pointer;
}

/* シートモード（SPEC §5.4） */
.sheet-section {
  min-height: 100vh;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.confirm-dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  max-width: 320px;
}

.confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

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

.secondary-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
}

.danger-btn {
  background: var(--danger);
  border: none;
  color: #1a0000;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: bold;
  cursor: pointer;
}
