/* tutorial-specific styles (see common.css for shared) */

body {
    line-height: 1.6;
    font-size: 1.1rem;
}

.app {
    width: 100%;
    margin: 0 auto;
    padding: 1rem 2rem;
}

/* ── Navigation ─────────────────────────────────────────── */

.nav-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0;
    border-bottom: 2px solid #333;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.nav-bar h1 {
    font-size: 1.6rem;
    color: #e2b96f;
    margin-right: auto;
    white-space: nowrap;
}

.app-subtitle {
    width: 100%;
    font-size: 0.9rem;
    color: #999;
    margin: -0.25rem 0 0.25rem 0;
}

.lang-select {
    font-size: 1rem;
}

.lesson-nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-btn {
    background: #2a2a3e;
    border: 1px solid #444;
    color: #ccc;
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.15s;
}

.nav-btn:hover { background: #3a3a5e; color: #fff; }
.nav-btn.active { background: #e2b96f; color: #1a1a2e; border-color: #e2b96f; font-weight: 600; }

/* ── Lesson layout ──────────────────────────────────────── */

.lesson { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.lesson h2 {
    font-size: 1.8rem;
    color: #e2b96f;
    margin-bottom: 0.5rem;
}

.concept {
    color: #aaa;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.example {
    background: #222240;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.example h3 {
    font-size: 1.2rem;
    color: #8bc6ec;
    margin-bottom: 0.75rem;
}

.example p { margin-bottom: 0.5rem; font-size: 1.05rem; }

ol.substeps {
    list-style: none;
    counter-reset: substep;
    padding-left: 2.5rem;
}

ol.substeps li::before {
    counter-increment: substep;
    content: "1." counter(substep, lower-alpha) " ";
    margin-left: -1.5rem;
    color: #aaa;
}

p.aside {
    background: #2a2a3a;
    border-left: 4px solid #6fa8dc;
    padding: 0.75rem 1rem;
    border-radius: 0 6px 6px 0;
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 1.05rem;
    color: #bbb;
}

.takeaway {
    background: #2a3a2a;
    border-left: 4px solid #4caf50;
    padding: 0.75rem 1rem;
    border-radius: 0 6px 6px 0;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

.takeaway strong { color: #7ddf7d; }

/* ── Tile images ────────────────────────────────────────── */

/* One variable drives all tile sizes.
   Phone  (400px) → 18vw = 72px    ~5 tiles/row
   Tablet (768px) → 12vw = 92px    ~7 tiles/row
   Laptop (1440px)→  8vw = 115px   ~12 tiles/row
   HD     (1920px)→  8vw = 154px
   4K     (3840px)→  6vw = 230px   ~16 tiles/row */
:root { --tile-w: 23vw; }
@media (min-width: 640px)  { :root { --tile-w: 12vw; } }
@media (min-width: 1024px) { :root { --tile-w: 8vw; } }
@media (min-width: 2560px) { :root { --tile-w: 6vw; } }

.tile-img {
    width: var(--tile-w);
    transition: transform 0.1s, box-shadow 0.1s;
}

.tile-img.clickable { cursor: pointer; }
.tile-img.clickable:hover { transform: translateY(-3px); box-shadow: 0 4px 8px rgba(0,0,0,0.4); }

.tile-img.selected {
    outline: 3px solid #e2b96f;
    outline-offset: 2px;
    transform: translateY(-4px);
}

.tile-img.small { width: calc(var(--tile-w) * 0.8); }

.tile-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    margin: 0.5rem 0;
}

.tile-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 0.75rem;
}

.tile-group-label {
    width: 100%;
    font-size: 0.95rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.wait-separator {
    color: #666;
    font-size: 1.5rem;
    padding: 0 0.25rem;
    align-self: center;
}

/* ── Info panel ──────────────────────────────────────────── */

.info-panel {
    background: #1e1e3a;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
    font-size: 1rem;
    min-height: 3rem;
}

.info-panel .label { color: #888; margin-right: 0.5rem; }
.info-panel .value { color: #e2b96f; font-weight: 600; }

.info-row {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

/* ── Tables ─────────────────────────────────────────────── */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1rem;
    margin-top: 0.75rem;
}

.data-table th {
    text-align: left;
    color: #888;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid #444;
    font-weight: 500;
}

.data-table td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid #2a2a3e;
}

.data-table tr:hover td { background: #2a2a3e; }
.data-table tr.best td { color: #7ddf7d; font-weight: 600; }

.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Buttons & Controls ─────────────────────────────────── */

.btn {
    background: #2a2a3e;
    border: 1px solid #444;
    color: #ccc;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.15s;
}

.btn:hover { background: #3a3a5e; color: #fff; }
.btn.active { background: #e2b96f; color: #1a1a2e; border-color: #e2b96f; }

.btn-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0.5rem 0;
}

.toggle-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0.5rem 0;
    align-items: center;
}

.toggle-row label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 1rem;
    cursor: pointer;
    color: #bbb;
}

.toggle-row label:hover { color: #fff; }

/* ── Shanten badge ──────────────────────────────────────── */

.shanten-badge {
    display: inline-block;
    background: #333;
    color: #e2b96f;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

.shanten-badge.complete { background: #2a5a2a; color: #7ddf7d; }
.shanten-badge.tenpai { background: #5a4a1a; color: #e2b96f; }

/* ── Score display ──────────────────────────────────────── */

.score-result {
    background: #1e1e3a;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
}

.score-total {
    font-size: 1.6rem;
    font-weight: 700;
    color: #e2b96f;
    margin-bottom: 0.5rem;
}

.score-pattern {
    display: flex;
    justify-content: space-between;
    padding: 0.2rem 0;
    font-size: 1rem;
}

.score-pattern .pts { color: #8bc6ec; font-weight: 600; }

/* ── Safety colors ──────────────────────────────────────── */

.safety-safe { color: #7ddf7d; }
.safety-caution { color: #e2b96f; }
.safety-danger { color: #e06060; }

/* ── Strategy badge ─────────────────────────────────────── */

.strategy-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
}

.strategy-badge.offensive { background: #4a2a2a; color: #e06060; }
.strategy-badge.defensive { background: #2a4a2a; color: #7ddf7d; }
.strategy-badge.balanced { background: #4a4a2a; color: #e2b96f; }

/* ── Discard cards ─────────────────────────────────────── */

.discard-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 0.75rem;
}
@media (min-width: 640px)  { .discard-cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .discard-cards { grid-template-columns: repeat(3, 1fr); } }

.discard-card {
    background: #1e1e3a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 0.75rem;
}

.discard-card.best {
    border-color: #7ddf7d;
    background: #1e2e1e;
}

.discard-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.discard-card-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.discard-card-stat {
    display: flex;
    justify-content: space-between;
    padding: 0.15rem 0;
}

.discard-card-stat .label {
    color: #888;
}

.discard-card-stat .value {
    font-weight: 600;
    color: #e2b96f;
}

.outs-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.3rem;
}

.out-tile {
    display: inline-flex;
    align-items: center;
    gap: 0.1rem;
}

.out-tile .tile-img {
    width: calc(var(--tile-w) * 0.6);
}

.out-count {
    font-size: 0.75rem;
    color: #e2b96f;
    font-weight: 600;
}

/* ── Tier patterns ─────────────────────────────────────── */

.tier-group { margin-bottom: 0.75rem; }
.tier-group h4 { color: #8bc6ec; font-size: 1.05rem; margin-bottom: 0.4rem; }

.tier-patterns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tier-entry {
    display: inline-block;
    background: #2a2a3e;
    border: 1px solid #444;
    border-radius: 12px;
    padding: 0.2rem 0.6rem;
    font-size: 0.95rem;
}

.tier-entry.clickable {
    cursor: pointer;
    border-color: #e2b96f55;
    transition: all 0.15s;
}

.tier-entry.clickable:hover {
    background: #3a3a5e;
    border-color: #e2b96f;
    transform: translateY(-1px);
}

.tier-entry .pts { color: #e2b96f; font-weight: 600; }

.tier-entry.situational {
    border-style: dashed;
    color: #b0b0c8;
}

.tier-entry.situational .pts { color: #b0a06f; }

/* ── 3-fan minimum indicator ──────────────────────────── */

.minimum-indicator {
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.minimum-indicator.meets { background: #2a5a2a; color: #7ddf7d; }
.minimum-indicator.below { background: #5a2a2a; color: #e06060; }

/* ── Situational toggles (shared with scoring app) ──────── */

.situational-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.situational-toggle {
    display: flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.4rem 0.6rem;
    border: 2px solid #444;
    border-radius: 8px;
    background: #1a1a2e;
    color: #ccc;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.situational-toggle:hover { border-color: #888; }
.situational-toggle.checked {
    border-color: #4fc3f7;
    background: #4fc3f722;
    color: #4fc3f7;
}

/* ── Payment calculator ────────────────────────────────── */

.payment-table td { padding: 0.4rem 0.6rem; }

/* ── Canvas & animation controls ───────────────────────── */

.viz-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
}

.viz-btn {
    display: block;
    margin: 20px auto;
    padding: 12px 24px;
    font-size: 1.1rem;
    cursor: pointer;
    border: 1px solid #555;
    background: #2a2a3e;
    color: #e0e0e0;
    border-radius: 6px;
}

.phase-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.phase-toggle {
    padding: 8px 16px;
    font-size: 1rem;
    cursor: pointer;
    border: 1px solid #444;
    background: #1a1a2e;
    color: #888;
    border-radius: 6px;
}

.phase-toggle.active {
    border-color: #777;
    background: #4a4a6e;
    color: #fff;
    font-weight: bold;
}

.step-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    width: 100%;
    max-width: 600px;
}

.step-btn {
    padding: 8px 20px;
    font-size: 1rem;
    cursor: pointer;
    border: 1px solid #555;
    background: #2a2a3e;
    color: #e0e0e0;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.step-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.step-label {
    flex: 1;
    text-align: center;
    font-size: 1rem;
    color: #e0e0e0;
    min-width: 0;
}

/* ── Preset cards (lesson 0) ────────────────────────────── */

.preset-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
@media (min-width: 640px)  { .preset-cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .preset-cards { grid-template-columns: repeat(3, 1fr); } }

.preset-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem;
    background: #1e1e3a;
    border: 2px solid #333;
    border-radius: 8px;
    color: #ccc;
    font-size: 1rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
}

.preset-card:hover {
    border-color: #888;
    background: #2a2a3e;
}

.preset-card.selected {
    border-color: #e2b96f;
    background: #2a2a1e;
}

.preset-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: #e2b96f;
}

.preset-card.selected .preset-name {
    color: #f0d080;
}

.preset-desc {
    font-size: 0.9rem;
    color: #999;
    line-height: 1.4;
}

.preset-stats {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.15rem;
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 640px) {
    .nav-bar h1 { font-size: 1.3rem; width: 100%; }
    .data-table { font-size: 0.9rem; }
    .data-table th, .data-table td { padding: 0.3rem 0.4rem; }

    .viz-btn { display: none !important; }
    .phase-toggle { padding: 6px 10px; font-size: 0.9rem; }
    .step-btn { padding: 8px 12px; }
    .step-label { font-size: 0.9rem; }
}
