/* ============================================================
   GLOBAL RESET
   ============================================================ */
html, body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

* {
    box-sizing: border-box;
}

/* ============================================================
   BASE PALETTE
   ============================================================ */
:root {
    --ink: #000;
    --paper: #f7f7f7;
    --line: #ccc;
}

/* ============================================================
   APP WRAPPER
   ============================================================ */
.iching-app {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 0 12px;
}

@media (max-width: 800px) {
    .iching-app {
        max-width: 100%;
    }
}

/* ============================================================
   TABS
   ============================================================ */
.iching-tabs {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--line);
    margin-top: 20px;
    padding-left: 4px;
}

.tab-button {
    background: var(--paper);
    border: 1px solid var(--line);
    border-bottom: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 16px;
    color: var(--ink);
    border-radius: 6px 6px 0 0;
    margin-right: 4px;
    position: relative;
    top: 1px;
}

.tab-button.active {
    background: #fff;
    border-bottom: 1px solid #fff;
    font-weight: bold;
}

/* ============================================================
   TAB PANELS
   ============================================================ */
.tab-panel {
    display: none;
    padding: 20px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 0 6px 6px 6px;
    margin-top: -1px;
}

.tab-panel.active {
    display: block;
}

.right-panel {
    margin-top: 28px;   
}
/* ============================================================
   PHASE 1
   ============================================================ */
.phase1 {
    max-width: 100%;
    margin: 0 auto;
    padding: 10px 10px;
    text-align: center;
}

@media (min-width: 800px) {
    .phase1 {
        max-width: 600px;
    }
}

.iching-title {
    font-size: 40px;
    margin-bottom: 6px;
    color: var(--ink);
}

.iching-subtitle {
    font-size: 22px;
    margin-bottom: 20px;
    color: var(--ink);
}

.question-box {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink);
    font-size: 16px;
    margin-top: 20px;
}

.phase1-buttons {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.ask-button,
.reset-button {
    padding: 10px 20px;
    background: var(--ink);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}


.fade-start {
    opacity: 0;
}

/* ============================================================
   PHASE 2
   ============================================================ */
.phase2 {
    padding: 10px;
}

.results-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.results-panel {
    background: none;
    border: none;
    padding: 10px;
   
}

@media (min-width: 800px) {
    .results-wrapper {
        flex-direction: row;
    }
    .results-panel {
        flex: 1;
    }
}

.phase2-buttons {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.phase2-button {
    padding: 10px 20px;
    background: var(--ink);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#results-left {
    text-align: right;
}

#results-left .trigram {
    margin-left: auto;
    margin-right: 0;
}

/* ============================================================
   FOOTER
   ============================================================ */
.iching-footer {
    margin-top: 40px;
    padding: 20px;
    text-align: center;
    color: var(--ink);
    background: var(--paper);
    border-top: 1px solid var(--line);
}

.iching-footer a {
    color: var(--ink);
}

.poetic-line {
    font-style: italic;
}

/* ============================================================
   TRIGRAM + HEXAGRAM LINES
   ============================================================ */

.trigram {
    width: 140px;
    margin: 0 auto;
    padding: 10px 0;
}

@media (max-width: 500px) {
    .trigram {
        width: 100px;
    }
}

/* Solid line */
.line:not(.broken) {
    height: 12px;
    background: var(--ink);
    margin: 10px 0;
    border-radius: 2px;
}

/* Broken line */
.line.broken {
    height: 12px;
    background: none;
    margin: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.line.broken::before,
.line.broken::after {
    content: "";
    display: block;
    height: 12px;
    width: 45%;
    background: var(--ink);
    border-radius: 2px;
}

/* ============================================================
   TRIGRAM IDENTITIES (NEUTRAL, NO COLOUR OVERRIDES)
   ============================================================ */

/* Heaven */
.trigram-heaven .line:not(.broken),
.trigram-heaven .line.broken::before,
.trigram-heaven .line.broken::after {
    background: var(--ink);
}

/* Lake */
.trigram-lake .line:not(.broken),
.trigram-lake .line.broken::before,
.trigram-lake .line.broken::after {
    background: var(--ink);
}

/* Fire */
.trigram-fire .line:not(.broken),
.trigram-fire .line.broken::before,
.trigram-fire .line.broken::after {
    background: var(--ink);
}

/* Thunder */
.trigram-thunder .line:not(.broken),
.trigram-thunder .line.broken::before,
.trigram-thunder .line.broken::after {
    background: var(--ink);
}

/* Wind */
.trigram-wind .line:not(.broken),
.trigram-wind .line.broken::before,
.trigram-wind .line.broken::after {
    background: var(--ink);
}

/* Water */
.trigram-water .line:not(.broken),
.trigram-water .line.broken::before,
.trigram-water .line.broken::after {
    background: var(--ink);
}

/* Mountain */
.trigram-mountain .line:not(.broken),
.trigram-mountain .line.broken::before,
.trigram-mountain .line.broken::after {
    background: var(--ink);
}

/* Earth */
.trigram-earth .line:not(.broken),
.trigram-earth .line.broken::before,
.trigram-earth .line.broken::after {
    background: var(--ink);
}

/* ============================================================
   ANIMATION
   ============================================================ */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.8s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}
