* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background-color: #08090c;
    color: #c5cdd8;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    font-size: 11px;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

a, a:visited {
    color: inherit;
    text-decoration: none;
}

#top-header {
    height: 52px;
    background: #090c12;
    border-bottom: 1px solid #192231;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    flex-shrink: 0;
    gap: 16px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #ffffff;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.brand-link:hover {
    opacity: 0.85;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-title {
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #ffffff;
}

.brand-subtitle {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 1.6px;
    color: #5c6b7e;
}

.accent {
    color: #00e5ff;
}

.header-divider {
    width: 1px;
    height: 22px;
    background: #1c2536;
}

.tool-tag-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tool-name {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #c5cdd8;
}

.tool-badge {
    background: #16202c;
    color: #00e5ff;
    border: 1px solid #233549;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.btn-back-home, 
.btn-back-home:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #121722;
    border: 1px solid #1f2a3a;
    color: #8c9ba5 !important;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none !important;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-back-home:hover {
    background: rgba(0, 229, 255, 0.12);
    border-color: #00e5ff;
    color: #00e5ff !important;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

.header-center {
    flex: 1;
    margin: 0 12px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#canvas-container {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #040507;
}

#wtCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

#control-dock {
    height: 82px;
    background: #0e1117;
    border-top: 1px solid #1c222d;
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 16px;
    flex-shrink: 0;
    overflow-x: auto;
}

.dock-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #131720;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #1c2331;
    height: 66px;
    justify-content: center;
}

.group-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #5a6679;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ctrl-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ctrl-field label {
    font-size: 9px;
    color: #8c9ba5;
    font-weight: 600;
}

.stepper-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sep {
    color: #4a5568;
    font-weight: bold;
}

select, input[type="number"] {
    background: #0a0d13;
    border: 1px solid #232c3d;
    color: #e2e8f0;
    font-size: 11px;
    padding: 4px 6px;
    border-radius: 4px;
    outline: none;
    transition: border-color 0.2s;
}

select:focus, input[type="number"]:focus {
    border-color: #00e5ff;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #232c3d;
    border-radius: 2px;
    outline: none;
    width: 90px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #00e5ff;
    cursor: pointer;
}

button {
    cursor: pointer;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-primary {
    background: #00e5ff;
    color: #040507;
    padding: 6px 14px;
}

.btn-primary:hover {
    background: #33ecff;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

.btn-small {
    background: #1f2737;
    color: #c5cdd8;
    padding: 4px 8px;
    border: 1px solid #2d384e;
}

.btn-small:hover {
    background: #2a354b;
    color: #ffffff;
}

.btn-accent {
    background: #1a2c38;
    border-color: #00a8bb;
    color: #00e5ff;
}

.btn-accent:hover {
    background: #00e5ff;
    color: #000;
}

#app-tooltip {
    position: fixed;
    pointer-events: none;
    background: rgba(13, 17, 24, 0.95);
    border: 1px solid #00e5ff;
    border-radius: 6px;
    padding: 8px 12px;
    color: #e2e8f0;
    font-size: 11px;
    max-width: 250px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7), 0 0 10px rgba(0, 229, 255, 0.2);
    z-index: 10000;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    backdrop-filter: blur(8px);
}

#app-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.tip-title {
    font-weight: 700;
    color: #00e5ff;
    font-size: 11px;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.tip-desc {
    color: #a0aec0;
    font-size: 10px;
    line-height: 1.4;
}

.tip-key {
    display: inline-block;
    margin-top: 5px;
    background: #1a2233;
    color: #81e6d9;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    border: 1px solid #23304a;
}

.btn-secondary {
    background: #151a24;
    color: #a0aec0;
    border: 1px solid #242e42;
    padding: 6px 12px;
}
.btn-secondary:hover {
    background: #1f2737;
    color: #ffffff;
    border-color: #3b4968;
}

#control-dock {
    height: 84px;
    background: #0e1117;
    border-top: 1px solid #1c222d;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    gap: 12px;
    flex-shrink: 0;
    overflow-x: auto;
}

.dock-center-group {
    background: #111622 !important;
    border-color: #243247 !important;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.08);
}

.wide-slider {
    width: 140px !important;
}

.synth-station {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #090c12;
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid #1a2333;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

.btn-synth-play {
    background: #16202c;
    color: #00e5ff;
    border: 1px solid #00e5ff;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-synth-play:hover {
    background: #00e5ff;
    color: #040507;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.4);
}

.btn-synth-play.playing {
    background: #ff3366 !important;
    border-color: #ff3366 !important;
    color: #ffffff !important;
    box-shadow: 0 0 14px rgba(255, 51, 102, 0.5) !important;
}

.btn-sweep-off {
    background: #131822;
    color: #718096;
    border: 1px solid #232c3d;
}

.btn-sweep-on {
    background: #112836 !important;
    color: #00e5ff !important;
    border-color: #00e5ff !important;
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.3);
}

.synth-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.synth-field label {
    font-size: 8px;
    font-weight: 700;
    color: #5a6679;
    letter-spacing: 0.5px;
}

.synth-key-hint {
    background: #121722;
    border: 1px solid #1d2638;
    color: #8c9ba5;
    font-size: 9px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

dialog#manual-modal {
    margin: auto;
    padding: 0;
    border: 1px solid #1f2e42;
    border-radius: 8px;
    background: #0b0f16;
    color: #c5cdd8;
    width: min(880px, 92vw);
    height: min(700px, 85vh);
    max-width: 100vw;
    max-height: 100vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 25px rgba(0, 229, 255, 0.12);
    overflow: hidden;
}

dialog#manual-modal::backdrop {
    background: rgba(4, 5, 7, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.manual-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.manual-header {
    height: 52px;
    background: #090c12;
    border-bottom: 1px solid #1a2536;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.manual-title {
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #ffffff;
    margin: 0;
    line-height: 1.1;
}

.manual-subtitle {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 1.4px;
    color: #5c6b7e;
}

.btn-close {
    background: transparent;
    border: 1px solid transparent;
    color: #8c9ba5;
    font-size: 16px;
    line-height: 1;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-close:hover {
    color: #00e5ff;
    border-color: #00e5ff;
    background: rgba(0, 229, 255, 0.08);
}

.manual-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.manual-nav {
    width: 210px;
    background: #080b10;
    border-right: 1px solid #16202e;
    padding: 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.manual-nav-link {
    display: block;
    padding: 8px 10px;
    border-radius: 4px;
    color: #798a9d;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}

.manual-nav-link:hover {
    color: #00e5ff;
    background: #111722;
}

.manual-nav-link.active {
    background: rgba(0, 229, 255, 0.1);
    color: #00e5ff;
    border-left: 2px solid #00e5ff;
}

.manual-content-scroll {
    flex: 1;
    padding: 24px 28px;
    overflow-y: auto;
    scroll-behavior: smooth;
    color: #a4b3c6;
    line-height: 1.6;
}

.manual-content-scroll section {
    margin-bottom: 36px;
}

.manual-content-scroll h3 {
    color: #00e5ff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.6px;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #192433;
}

.manual-content-scroll p, 
.manual-content-scroll ul, 
.manual-content-scroll ol {
    margin-bottom: 12px;
}

.manual-content-scroll ul, 
.manual-content-scroll ol {
    padding-left: 20px;
}

.manual-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 11px;
}

.manual-table th, 
.manual-table td {
    padding: 8px 10px;
    border: 1px solid #182333;
    text-align: left;
}

.manual-table th {
    background: #0e141f;
    color: #00e5ff;
    font-size: 9px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.manual-content-scroll kbd {
    background: #141c27;
    border: 1px solid #253347;
    border-radius: 3px;
    padding: 2px 5px;
    color: #00e5ff;
    font-family: monospace;
    font-size: 10px;
}

.manual-content-scroll::-webkit-scrollbar {
    width: 6px;
}
.manual-content-scroll::-webkit-scrollbar-track {
    background: #080b10;
}
.manual-content-scroll::-webkit-scrollbar-thumb {
    background: #1c2738;
    border-radius: 3px;
}
.manual-content-scroll::-webkit-scrollbar-thumb:hover {
    background: #00e5ff;
}

.manual-content-scroll h4 {
    color: #e2e8f0;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-top: 18px;
    margin-bottom: 8px;
}

.manual-content-scroll ul ul,
.manual-content-scroll ol ul {
    margin-top: 4px;
    margin-bottom: 8px;
    color: #8c9ba5;
    font-size: 10.5px;
}

.manual-content-scroll strong {
    color: #e2e8f0;
}

.manual-content-scroll code {
    background: #141b27;
    border: 1px solid #202b3a;
    color: #00e5ff;
    padding: 1px 4px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 10px;
}
