* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #e8e8e8;
    color: #333333;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 11px;
    min-height: 100vh;
}

a { color: #003399; }
a:hover { color: #ff6600; }

/* === Page Layout === */

.page-table {
    width: 780px;
    margin: 12px auto;
    border-collapse: collapse;
    border: 1px solid #999999;
}

.page-cell {
    background: #ffffff;
    padding: 0;
    vertical-align: top;
}

/* === Header === */

.header {
    background: #336699;
    padding: 8px 12px;
    border-bottom: 2px solid #003366;
}

.header-title {
    color: #ffffff;
    font-size: 14px;
    font-weight: bold;
}

.header-build {
    color: #aaccee;
    font-size: 10px;
    float: right;
    line-height: 18px;
}

/* === Menu Bar === */

.menu-bar {
    display: flex;
    background: #f0f0f0;
    border-bottom: 1px solid #cccccc;
    font-size: 11px;
    user-select: none;
    padding: 0;
}

.menu-item {
    position: relative;
    padding: 4px 12px;
    cursor: pointer;
    color: #333333;
}

.menu-item:hover {
    background: #336699;
    color: #ffffff;
}

.menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #ffffff;
    border: 1px solid #999999;
    min-width: 200px;
    z-index: 1000;
}

.menu-dropdown.visible {
    display: block;
}

.menu-entry {
    padding: 4px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    white-space: nowrap;
    color: #333333;
}

.menu-entry:hover {
    background: #336699;
    color: #ffffff;
}

.menu-separator {
    border-top: 1px solid #cccccc;
    margin: 2px 0;
}

.shortcut {
    color: #999999;
    font-size: 10px;
    margin-left: 16px;
}

.menu-entry:hover .shortcut {
    color: #cccccc;
}

/* === Toolbar === */

.toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    background: #f5f5f5;
    border-bottom: 1px solid #cccccc;
}

.toolbar-sep {
    color: #333333;
    font-size: 11px;
    margin-left: 6px;
}

.toolbar-checkbox {
    color: #333333;
    font-size: 11px;
    margin-left: 8px;
    cursor: pointer;
}

.file-label {
    display: inline-block;
    padding: 4px 14px;
    background: linear-gradient(to bottom, #f7f7f7, #e0e0e0);
    color: #333333;
    border: 1px solid #aaaaaa;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.file-label:hover {
    background: linear-gradient(to bottom, #ffffff, #e8e8e8);
    border-color: #888888;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.file-label input[type="file"] {
    display: none;
}

.url-input {
    flex: 1;
    min-width: 160px;
    padding: 4px 6px;
    background: #ffffff;
    color: #333333;
    border: 1px solid #aaaaaa;
    border-radius: 4px;
    font-size: 11px;
    font-family: Verdana, Arial, Helvetica, sans-serif;
}

/* === Buttons === */

.btn {
    padding: 4px 14px;
    background: linear-gradient(to bottom, #f7f7f7, #e0e0e0);
    color: #333333;
    border: 1px solid #aaaaaa;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.btn:hover:not(:disabled) {
    background: linear-gradient(to bottom, #ffffff, #e8e8e8);
    border-color: #888888;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.btn:active:not(:disabled) {
    background: linear-gradient(to bottom, #d8d8d8, #e0e0e0);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.15);
}

.btn:disabled {
    color: #aaaaaa;
    cursor: default;
    opacity: 0.7;
}

.btn-primary {
    font-weight: bold;
    background: linear-gradient(to bottom, #4a88c0, #336699);
    color: #ffffff;
    border-color: #2a5580;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(to bottom, #5a99d0, #4477aa);
    border-color: #336699;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.btn-primary:active:not(:disabled) {
    background: linear-gradient(to bottom, #2a5580, #336699);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
}

.btn-sm {
    padding: 1px 6px;
    font-size: 10px;
}

/* === Stage Area === */

.stage-panel {
    padding: 10px;
    background: #eeeeee;
    display: flex;
    justify-content: center;
}

.stage-inset {
    background: #000000;
    display: inline-block;
    line-height: 0;
}

canvas {
    display: block;
}

/* === Transport Controls === */

.transport {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    background: #f5f5f5;
    border-top: 1px solid #cccccc;
    border-bottom: 1px solid #cccccc;
}

.transport-btn {
    min-width: 70px;
    font-size: 11px;
}

.frame-info {
    font-size: 10px;
    color: #666666;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    white-space: nowrap;
    min-width: 90px;
}

/* === Status Bar === */

.statusbar {
    background: #f0f0f0;
    border-top: 1px solid #cccccc;
    padding: 4px 8px;
    font-size: 11px;
    color: #666666;
}

/* === Footer === */

.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #336699;
    color: #aaccee;
    font-size: 11px;
}

.footer a {
    color: #ffffff;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
    color: #ffcc66;
}

/* === Loading Overlay === */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-title {
    font-size: 18px;
    font-weight: bold;
    color: #ffffff;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    margin-bottom: 12px;
}

.loading-bar-container {
    width: 260px;
    height: 14px;
    background: #333333;
    border: 1px solid #666666;
    padding: 2px;
}

.loading-bar {
    height: 100%;
    background: #336699;
    width: 0%;
    transition: width 0.3s ease;
}

.loading-text {
    font-size: 11px;
    color: #999999;
    margin-top: 8px;
    font-family: Verdana, Arial, Helvetica, sans-serif;
}

/* === Modal Overlay === */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-window {
    background: #ffffff;
    border: 1px solid #999999;
    width: 680px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-titlebar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    background: #336699;
    color: #ffffff;
    font-weight: bold;
    font-size: 11px;
}

.modal-close-btn {
    background: #eeeeee;
    border: 1px solid #999999;
    color: #333333;
    font-size: 10px;
    font-weight: bold;
    padding: 0 5px;
    cursor: pointer;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    line-height: 16px;
}

.modal-close-btn:hover {
    background: #dddddd;
}

.modal-body {
    padding: 10px;
    font-size: 11px;
    line-height: 1.6;
}

.modal-hint {
    color: #999999;
    margin-bottom: 6px;
    font-size: 11px;
}

.modal-buttons {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    align-items: center;
}

.spacer {
    flex: 1;
}

/* === Params Table === */

.params-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 4px;
}

.params-table th {
    text-align: left;
    padding: 3px 4px;
    background: #f0f0f0;
    border: 1px solid #cccccc;
    font-weight: bold;
    font-size: 11px;
    color: #333333;
}

.params-table td {
    padding: 2px;
    border: 1px solid #eeeeee;
    vertical-align: top;
}

.param-input {
    width: 100%;
    box-sizing: border-box;
    padding: 2px 3px;
    background: #ffffff;
    color: #333333;
    border: 1px solid #999999;
    font-size: 11px;
    font-family: Verdana, Arial, Helvetica, sans-serif;
}

textarea.param-value {
    font-family: "Courier New", Courier, monospace;
    font-size: 11px;
    resize: vertical;
    word-break: break-all;
    white-space: pre-wrap;
}

.param-key {
    width: 60px;
}

/* === Basic page compatibility === */

.container {
    padding: 8px;
}

.controls {
    margin-bottom: 6px;
}

.file-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.or {
    color: #999999;
    font-size: 11px;
}

#url-input {
    flex: 1;
    min-width: 160px;
    padding: 2px 4px;
    background: #ffffff;
    color: #333333;
    border: 1px solid #999999;
    font-size: 11px;
    font-family: Verdana, Arial, Helvetica, sans-serif;
}

.main-content {
    display: flex;
    flex: 1;
    min-height: 0;
}

.stage-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.stage-wrapper {
    border: 1px solid #999999;
    background: #000000;
    display: inline-block;
    line-height: 0;
}

.transport-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
}

.transport-controls button {
    padding: 2px 8px;
    min-width: 24px;
    font-size: 11px;
    background: #eeeeee;
    color: #333333;
    border: 1px solid #999999;
    font-family: Verdana, Arial, Helvetica, sans-serif;
}

.transport-controls button:hover:not(:disabled) {
    background: #dddddd;
}

.transport-controls button:disabled {
    color: #999999;
}

.status {
    font-size: 11px;
    color: #666666;
    padding: 3px 0;
}
