/* PowerShell-like Terminal Styles */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    background-color: #0d1117;
    color: #e6edf3;
    font-family: 'Consolas', 'Courier New', monospace;
    margin: 0;
    padding: 12px;
    display: flex;
}

.terminal-container {
    background-color: #010409;
    border-radius: 8px;
    border: 1px solid #30363d;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.terminal-header {
    background: linear-gradient(180deg, #21262d, #161b22);
    padding: 10px 14px;
    font-size: 13px;
    border-bottom: 1px solid #30363d;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.terminal-dots {
    display: flex;
    gap: 7px;
    width: 70px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.dot.red { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green { background: #28c840; }

.terminal-title {
    color: #8b949e;
    text-align: center;
}

.terminal-title-ghost {
    width: 70px;
}

/* ============================== tabs ============================== */
.tab-bar {
    display: flex;
    background: #0d1117;
    border-bottom: 1px solid #30363d;
    padding: 0 8px;
    flex-shrink: 0;
}

.tab {
    appearance: none;
    background: transparent;
    border: none;
    color: #8b949e;
    font-family: inherit;
    font-size: 13px;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    flex-shrink: 0;
}

.tab:hover {
    color: #e6edf3;
    background: rgba(255, 255, 255, 0.03);
}

.tab.active {
    color: #58a6ff;
    border-bottom-color: #58a6ff;
    font-weight: bold;
}

.terminal-body {
    flex-grow: 1;
    position: relative;
    min-height: 0;
}

.tab-panel {
    display: none;
    position: absolute;
    inset: 0;
    flex-direction: column;
}

.tab-panel.active {
    display: flex;
}

.scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px;
    cursor: text;
    min-height: 0;
}

.output-area {
    min-height: 0;
}

/* ============================== terminal text ============================== */
.terminal-body ::-webkit-scrollbar {
    width: 10px;
}

.terminal-body ::-webkit-scrollbar-track {
    background: #010409;
}

.terminal-body ::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 5px;
}

.line {
    margin: 0;
    padding: 0;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.5;
    font-size: 14px;
}

.line.gray { color: #8b949e; }
.line.green { color: #3fb950; }
.line.yellow { color: #e3b341; }
.line.cyan { color: #58a6ff; }
.line.red { color: #f85149; }
.line.white { color: #e6edf3; }
.line.dim { color: #6e7681; }

.cmdline {
    display: flex;
    align-items: baseline;
    margin: 6px 0 4px 0;
    line-height: 1.5;
    font-size: 14px;
}

.cmdline .prompt {
    color: #3fb950;
    margin-right: 8px;
    flex-shrink: 0;
}

.cmdline .cmd {
    color: #e6edf3;
    white-space: pre-wrap;
    word-break: break-all;
}

.input-container {
    display: flex;
    align-items: baseline;
    padding: 8px 0 10px 0;
}

.input-container .prompt {
    color: #3fb950;
    margin-right: 8px;
    flex-shrink: 0;
}

.command-input {
    background: transparent;
    border: none;
    outline: none;
    color: #e6edf3;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    flex-grow: 1;
    caret-color: #3fb950;
}

.command-input::selection {
    background: #58a6ff40;
}

/* ============================== branch tree SVG ============================== */
.branch-tree {
    margin: 10px 0;
    padding: 10px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    overflow-x: auto;
}

.branch-tree svg {
    display: block;
}

.branch-tree .branch-label {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
}

.branch-tree .commit-id {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
}

.branch-tree .commit-msg {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    fill: #8b949e;
}

.branch-tree .head-mark {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 10px;
    fill: #e3b341;
}

.branch-tree .tag-label {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 10px;
    fill: #f0b429;
}

.branch-tree .remote-mark {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 9px;
    fill: #8b949e;
}

/* ================= 上級者向け問題 ================= */
.pq-intro p {
    margin: 4px 0;
    color: inherit;
    line-height: 1.7;
}

.pq-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 12px;
    padding: 12px 4px 4px;
}

.pq-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    text-align: left;
    background: #1c2128;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 14px 18px;
    color: #e6edf3;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.pq-card:hover {
    border-color: #58a6ff;
    background: #22272e;
}

.pq-level {
    font-size: 12px;
    font-weight: bold;
    padding: 1px 9px;
    border-radius: 10px;
}

.pq-lv-1 { background: #16324f; color: #58a6ff; }
.pq-lv-2 { background: #27213a; color: #d29922; }
.pq-lv-3 { background: #3d1d0f; color: #f0883e; }

.pq-title {
    font-size: 16px;
    font-weight: bold;
    line-height: 1.5;
}

.pq-blurb {
    font-size: 13px;
    color: #8b949e;
    line-height: 1.7;
}

.pq-checks {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.pq-check {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #1c2128;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 10px 12px;
}

.pq-check .pq-mark {
    margin-right: 6px;
}

.pq-check.on {
    border-color: #2ea043;
}

.pq-check.off {
    border-color: #30363d;
}

.pq-desc {
    font-size: 14px;
    line-height: 1.6;
}

.pq-hint {
    font-size: 13px;
    color: #d29922;
}

.pq-check.on .pq-hint {
    color: #7ee787;
    font-size: 13px;
    margin-top: 2px;
}

.branch-title {
    margin: 0 0 6px 0;
    font-size: 13px;
    color: #e3b341;
}

/* ======================== workflow lesson ======================== */
.workflow-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    background: #161b22;
    border-bottom: 1px solid #30363d;
    flex-shrink: 0;
    flex: 0 0 auto;
}

.wf-hint-label {
    color: #8b949e;
    font-size: 12px;
}

.btn {
    appearance: none;
    background: #21262d;
    color: #e6edf3;
    border: 1px solid #30363d;
    border-radius: 6px;
    font-family: inherit;
    font-size: 12px;
    padding: 5px 12px;
    cursor: pointer;
    flex-shrink: 0;
}

.btn:hover {
    background: #30363d;
}

.btn.accent {
    background: #1f6feb;
    border-color: #1f6feb;
    color: #fff;
}

.btn.accent:hover {
    background: #388bfd;
}

.wf-lesson-area {
    margin-bottom: 6px;
}

/* 指示文エリア: 上部に固定し、出力と一緒にスクロールしない */
.lesson-area {
    flex: 0 0 auto;
    max-height: 45%;
    overflow-y: auto;
    padding: 8px 14px 4px;
    min-height: 0;
    border-bottom: 1px solid #21262d;
    background: #0d1117;
}

/* progress bar */
.wf-progress-wrap {
    margin: 10px 0 14px 0;
}

.wf-progress-label {
    font-size: 12px;
    color: #8b949e;
    margin-bottom: 5px;
}

.wf-progress-bar {
    height: 8px;
    background: #21262d;
    border-radius: 4px;
    overflow: hidden;
}

.wf-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #58a6ff, #3fb950);
    transition: width 0.3s ease;
}

.wf-step-title {
    font-size: 17px;
    font-weight: bold;
    color: #e6edf3;
    margin: 0 0 10px 0;
}

.wf-step-title .wf-step-no {
    color: #58a6ff;
    margin-right: 8px;
}

.wf-body {
    font-size: 14px;
    line-height: 1.8;
    color: #c9d1d9;
    margin: 0 0 14px 0;
}

.wf-body p {
    margin: 0 0 8px 0;
}

.wf-label {
    font-size: 13px;
    font-weight: bold;
    color: #58a6ff;
    margin: 14px 0 6px 0;
}

.wf-cmd-line {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    color: #3fb950;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
}

.wf-parts {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wf-part {
    display: flex;
    gap: 12px;
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 6px;
    padding: 8px 12px;
    align-items: baseline;
}

.wf-part .wf-token {
    color: #f778ba;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-all;
    min-width: 150px;
    flex-shrink: 0;
}

.wf-part .wf-desc {
    color: #c9d1d9;
    font-size: 13px;
    line-height: 1.6;
}

.wf-hint {
    display: none;
    background: #21262d40;
    border: 1px dashed #30363d;
    border-radius: 6px;
    padding: 10px 12px;
    color: #e3b341;
    font-size: 13px;
    line-height: 1.7;
    margin: 10px 0;
}

.wf-hint.show {
    display: block;
}

.wf-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 4px 0;
}

.wf-actions .btn.run {
    background: #1f6feb;
    border-color: #1f6feb;
    color: #fff;
}

.wf-actions .btn.run:hover {
    background: #388bfd;
}

.wf-feedback {
    margin: 10px 0 0 0;
}

.wf-badge {
    display: inline-block;
    background: #238636;
    color: #fff;
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: bold;
    margin-top: 10px;
}

.wf-success {
    color: #3fb950;
    font-size: 14px;
    line-height: 1.8;
    margin-top: 6px;
}

.wf-done-title {
    font-size: 22px;
    font-weight: bold;
    color: #3fb950;
    margin: 14px 0 10px 0;
}

.wf-done-body {
    color: #c9d1d9;
    line-height: 1.9;
    font-size: 14px;
}

.wf-done-body code {
    color: #f778ba;
}

/* ======================== 早見表 (cheat sheet) ======================== */
.cs-toolbar {
    justify-content: flex-start;
    gap: 10px;
}

.cs-search {
    flex: 1;
    max-width: 460px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #e6edf3;
    font-family: inherit;
    font-size: 14px;
    padding: 7px 12px;
    outline: none;
}

.cs-search:focus {
    border-color: #58a6ff;
}

.cs-search::placeholder {
    color: #6e7681;
}

.cs-count {
    color: #8b949e;
    font-size: 13px;
    white-space: nowrap;
}

.cs-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 14px;
    background: #161b22;
    border-bottom: 1px solid #30363d;
    flex: 0 0 auto;
}

.cs-chip {
    appearance: none;
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 14px;
    font-family: inherit;
    font-size: 13px;
    padding: 4px 14px;
    cursor: pointer;
}

.cs-chip:hover {
    background: #30363d;
}

.cs-chip.active {
    background: #1f6feb;
    border-color: #1f6feb;
    color: #fff;
    font-weight: bold;
}

.cs-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.cs-content {
    padding: 14px 16px 24px;
    margin: 0 auto;
    max-width: 1280px;
}

.cs-section {
    margin-bottom: 26px;
}

/* カードを 2〜4 列のグリッドに整列して左右バランスを取る */
.cs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 12px;
    align-items: stretch;
}

.cs-section-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: bold;
    color: #e6edf3;
    margin: 0 0 10px 0;
}

.cs-card {
    background: #1c2128;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 14px 18px;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.cs-card:hover {
    border-color: #58a6ff;
    background: #22272e;
}

.cs-card-title {
    font-size: 16px;
    font-weight: bold;
    color: #e6edf3;
    margin-bottom: 8px;
    line-height: 1.5;
}

.cs-label {
    font-size: 12px;
    font-weight: bold;
    color: #8b949e;
    margin: 8px 0 4px 0;
}

.cs-cmds {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cs-cmd-row {
    display: flex;
    gap: 10px;
    align-items: baseline;
    flex-wrap: wrap;
}

.cs-cmd {
    font-family: 'Cascadia Mono', 'Consolas', monospace;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 5px;
    color: #3fb950;
    font-size: 14px;
    padding: 2px 8px;
    white-space: pre-wrap;
    word-break: break-all;
    flex-shrink: 0;
}

.cs-cmd-d {
    color: #c9d1d9;
    font-size: 14px;
    line-height: 1.6;
    min-width: 0;
}

.cs-steps {
    margin: 0;
    padding-left: 20px;
    color: #c9d1d9;
    font-size: 14px;
    line-height: 1.8;
}

.cs-steps li {
    margin-bottom: 2px;
}

.cs-note {
    margin-top: auto;
    padding-top: 8px;
    background: #161b2240;
    border: 1px dashed #30363d;
    border-radius: 6px;
    padding: 6px 10px;
    color: #e3b341;
    font-size: 13px;
    line-height: 1.7;
}

.cs-empty {
    text-align: center;
    color: #8b949e;
    font-size: 15px;
    line-height: 1.9;
    padding: 40px 20px;
}

.cs-foot {
    text-align: center;
    color: #6e7681;
    font-size: 13px;
    margin-top: 8px;
}