/* docs/css/style.css */

@import 'variables.css';

* {
    box_sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family-base);
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

#header {
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 25px;
    position: relative;
    background: rgba(30, 30, 30, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 10;
    flex-wrap: nowrap;
    overflow: hidden;
}

#chart-title {
    margin: 0;
    font-size: var(--font-size-title);
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    white-space: nowrap;
    margin-right: 20px;
    z-index: 1;
}

#controls {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
    min-width: 0;
    z-index: 2;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    opacity: 1;
    visibility: visible;
}

@media (max-width: 1250px) {
    #controls {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
}

#btn-play {
    background: var(--text-primary);
    color: var(--bg-color);
    border: none;
    width: 72px;
    padding: 6px 0;
    text-align: center;
    border-radius: 20px;
    font-size: var(--font-size-btn);
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s;
    white-space: nowrap;
    flex-shrink: 0;
}
#btn-play:active {
    transform: scale(0.95);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-control);
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

input[type=range] {
    width: 100px;
    accent-color: var(--text-primary);
}

.value-tag {
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    font-weight: 600;
    width: 35px;
    text-align: right;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #444;
    transition: .3s;
    border-radius: 26px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}
.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
input:checked + .slider {
    background-color: var(--accent-color);
}
input:checked + .slider:before {
    transform: translateX(20px);
}

#time-display {
    font-size: var(--font-size-time);
    font-weight: 800;
    font-family: var(--font-family-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
    color: var(--text-primary);
    margin-left: auto;
    padding-left: 20px;
    white-space: nowrap;
    z-index: 1;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

#lang-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    color-scheme: dark;

    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);

    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 40px 10px 14px;

    font-family: inherit;
    font-size: 1.0rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;

    outline: none;

    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 14px top 50%;
    background-size: 12px auto;
}
#lang-select:hover, #lang-select:focus {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-color);
}
#lang-select:focus {
    background-color: rgba(255, 255, 255, 0.2);
    /* 聚焦时显示微弱边框，而不是默认的粗白边 */
    border-color: rgba(255, 255, 255, 0.3);
}

#lang-select option {
    /* 显式指定背景色作为保险 */
    background-color: #1e1e1e;
    color: var(--text-primary);
}

#chart-container {
    flex: 1;
    position: relative;
    border-radius: 16px;
    padding: 0;
    margin-top: 10px;
    overflow: hidden;
}

.bar-row {
    position: absolute;
    left: 0; right: 0;
    display: flex;
    align-items: center;
    padding: 0 10px;
}

.bar-rank {
    width: 40px;
    text-align: center;
    font-size: var(--font-size-bar-rank);
    font-weight: 800;
    font-family: var(--font-family-mono);
    color: #666;
    margin-right: 20px;
    flex-shrink: 0;
}

.bar-track {
    flex: 1;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.bar-fill {
    height: 81%;
    border-radius: var(--bar-radius);
    transition: width 0.1s linear, background-color 0.2s linear;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 18px;
    overflow: hidden;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    min-width: 30px;
    transform: translateZ(0);
}

.bar-title {
    font-size: var(--font-size-bar-title);
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
    margin-right: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 3;
    padding-bottom: 1px;
}

.bar-value {
    font-size: var(--font-size-bar-val);
    font-family: var(--font-family-mono);
    font-weight: 800;
    color: rgba(255,255,255,0.98);
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
    flex-shrink: 0;
}

#loading {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    color: var(--text-secondary);
}

body.capture-mode {
    background: var(--bg-color);
}
body.capture-mode #app {
    padding: 20px;
    max-width: none;
    height: 100vh;
}
body.capture-mode #header {
    padding: 0 40px;
    margin-bottom: 20px;
    justify-content: space-between;
}
body.capture-mode #controls {
    display: none;
}
body.capture-mode #time-display {
    font-size: var(--font-size-time-lg);
}
body.capture-mode #chart-title {
    font-size: var(--font-size-title-lg);
}
body.capture-mode #chart-container {
    margin: 0 20px 20px 20px;
}

#github-link {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 48px;
    height: 48px;
    color: var(--text-secondary);
    opacity: 0.6;
    transition: all 0.3s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}
#github-link:hover {
    color: var(--text-primary);
    opacity: 1;
    transform: scale(1.1);
}
#github-link svg {
    width: 100%;
    height: 100%;
    fill: currentColor; /* 跟随文字颜色 */
}
