/* Mac OS 9 Platinum — CSS variables isolate theme */
:root {
    --os9-desktop: #808080;
    --os9-platinum: #dddddd;
    --os9-light: #f5f5f5;
    --os9-mid: #c5c5c5;
    --os9-dark: #858585;
    --os9-darker: #555555;
    --os9-stripe: #a0a0a0;
    --os9-ink: #000000;
    --os9-accent: #3a62ab;
    --os9-font: "Charcoal", "Geneva", "Lucida Grande", "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body.os9-desktop {
    margin: 0;
    min-height: 100vh;
    font-family: var(--os9-font);
    font-size: 12px;
    color: var(--os9-ink);
    background-color: var(--os9-desktop);
    background-image:
        linear-gradient(45deg, rgba(255,255,255,0.06) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.06) 75%, transparent 75%);
    background-size: 4px 4px;
}

/* —— Menu bar —— */
.os9-menubar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    height: 20px;
    padding: 0 6px;
    background: linear-gradient(to bottom, #ffffff 0%, #dddddd 45%, #bbbbbb 100%);
    border-bottom: 1px solid #000;
    font-size: 12px;
    font-weight: bold;
}

.os9-apple {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 14px;
    margin-right: 10px;
    font-size: 14px;
    line-height: 1;
    color: #222;
    cursor: default;
    background: linear-gradient(
        to bottom,
        #5bc2f0 0 16%,
        #7ac943 16% 33%,
        #f5d547 33% 50%,
        #f0a12e 50% 66%,
        #e85d4c 66% 83%,
        #c77dd4 83% 100%
    );
    border-radius: 2px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.25);
}

.os9-apple::before {
    content: "";
    color: #111;
    font-size: 12px;
    text-shadow: 0 0 1px #fff;
}

.os9-menubar nav {
    display: flex;
    gap: 12px;
    flex: 1;
}

.os9-menubar nav span {
    cursor: default;
    padding: 0 2px;
}

.os9-menubar nav span:hover {
    background: var(--os9-accent);
    color: #fff;
}

.os9-menubar-right {
    margin-left: auto;
    font-weight: normal;
    display: flex;
    gap: 10px;
    align-items: center;
}

/* —— Desktop icons —— */
.os9-desktop-icons {
    position: absolute;
    top: 28px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 1;
}

.os9-icon {
    width: 64px;
    text-align: center;
    font-size: 11px;
    cursor: default;
    user-select: none;
}

.os9-icon-img {
    width: 32px;
    height: 32px;
    margin: 0 auto 4px;
    border: 1px solid var(--os9-darker);
    border-radius: 2px;
}

.os9-icon-img.hd {
    background: linear-gradient(135deg, #c5dff0, #4f8ecf);
}

.os9-icon-img.folder {
    background: linear-gradient(135deg, #f4d77b, #d4a017);
}

.os9-icon-img.trash {
    background: linear-gradient(135deg, #eee, #999);
    border-radius: 4px 4px 2px 2px;
}

.os9-icon-label {
    display: inline-block;
    padding: 1px 4px;
    background: transparent;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
}

.os9-icon:hover .os9-icon-label {
    background: var(--os9-accent);
    text-shadow: none;
}

/* —— Window —— */
.satu, .dua {
    width: 100%;
    text-align: center;
    position: relative;
}

#jw_os9 {
    --os9-win-bg: var(--os9-platinum);
    background: var(--os9-win-bg);
    width: 28%;
    min-width: 220px;
    max-width: 520px;
    margin: 36px auto 12px;
    border: 1px solid #000000;
    border-radius: 3px 3px 0 0;
    box-shadow:
        inset 1px 1px 0 #ffffff,
        inset -1px -1px 0 #666666,
        1px 1px 0 #000000;
    position: relative;
    z-index: 2;
    text-align: left;
}

#jw_os9.shaded .os9-window-body {
    display: none;
}

.os9-titlebar {
    height: 22px;
    display: flex;
    align-items: center;
    padding: 0 4px;
    gap: 5px;
    background-color: #dddddd;
    border-bottom: 1px solid #555555;
    border-radius: 2px 2px 0 0;
    cursor: default;
    user-select: none;
}

/* 标题栏凹线：仅「按钮 ↔ 标题」之间；DOM 横线，左右一致、导出不花 */
.os9-stripes {
    flex: 1 1 0;
    min-width: 10px;
    height: 13px;
    align-self: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    box-sizing: border-box;
    padding: 1px 0;
    background: #cfcfcf;
    border-top: 1px solid #555555;
    border-bottom: 1px solid #ffffff;
    overflow: hidden;
}

.os9-stripes i {
    display: block;
    height: 1px;
    margin: 0;
    padding: 0;
    border: 0;
    background: #4a4a4a;
    flex: 0 0 1px;
}

.os9-box {
    width: 13px;
    height: 13px;
    flex: 0 0 13px;
    background: linear-gradient(135deg, var(--os9-light), var(--os9-dark));
    border: 1px solid var(--os9-darker);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.os9-box.close::after {
    content: "";
    position: absolute;
    inset: 3px;
    border: 1px solid var(--os9-darker);
}

.os9-box.collapse::after {
    content: "";
    position: absolute;
    left: 2px;
    right: 2px;
    top: 5px;
    border-top: 2px solid var(--os9-darker);
}

.os9-box.zoom::after {
    content: "";
    position: absolute;
    inset: 2px;
    border: 1px solid var(--os9-darker);
}

.os9-title-text {
    flex: 0 0 auto;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    height: auto;
    text-align: center;
    font-weight: bold;
    font-size: 12px;
    line-height: 1;
    background: #dddddd;
    padding: 0 10px;
    overflow: visible;
    white-space: nowrap;
    /* 抵消字体度量 / html2canvas 偏下，光学垂直居中 */
    position: relative;
    top: -1px;
}

.os9-titlebar-right {
    display: flex;
    gap: 4px;
    flex: 0 0 auto;
}

.os9-window-body {
    background: #ffffff;
    border-top: 1px solid #999999;
}

#preview-host {
    text-align: center;
    padding: 10px;
    position: relative;
    min-height: 40px;
}

#img-avatar {
    max-width: 100%;
    vertical-align: middle;
}

#box {
    text-align: center;
    padding: 4px 6px 8px;
    color: var(--os9-ink);
}

#chooseImage {
    display: none;
}

/* Platinum push button：浅灰面 + 黑描边 + 左上亮/右下暗浮雕（对齐 OS 8/9 HIG） */
button,
.file-input-trigger {
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: var(--os9-font);
    font-size: 12px;
    font-weight: normal;
    line-height: 1;
    padding: 0 14px 2px;
    min-width: 58px;
    min-height: 20px;
    color: var(--os9-ink);
    cursor: pointer;
    background-color: #dddddd;
    background-image: none;
    border: 1px solid #000000;
    border-radius: 3px;
    box-shadow:
        inset 1px 1px 0 #ffffff,
        inset -1px -1px 0 #666666;
    outline: none;
}

button:active,
.file-input-trigger:active {
    background-color: #c8c8c8;
    box-shadow:
        inset 1px 1px 0 #555555,
        inset -1px -1px 0 #eeeeee;
}

/* 窗口内自定义按钮：与页面 Platinum 控件同款 chrome */
#box button,
#box .new_btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
    padding: 0 14px 2px;
    min-height: 20px;
    background-color: #dddddd;
    background-image: none;
    border: 1px solid #000000;
    border-radius: 3px;
    box-shadow:
        inset 1px 1px 0 #ffffff,
        inset -1px -1px 0 #666666;
}

.dua {
    padding-bottom: 56px;
}

#buttonTable {
    margin: 0 auto;
    background: var(--os9-platinum);
    border: 1px solid var(--os9-darker);
    width: 20em;
    max-width: 95%;
    text-align: center;
    font-size: 12px;
}

/* —— Control Strip —— */
.os9-control-strip {
    position: fixed;
    left: 8px;
    bottom: 8px;
    z-index: 40;
    display: flex;
    align-items: stretch;
    max-width: calc(100vw - 16px);
}

.os9-cs-toggle {
    width: 16px;
    background: linear-gradient(to bottom, var(--os9-light), var(--os9-mid));
    border: 1px solid #000;
    border-radius: 3px 0 0 3px;
    cursor: pointer;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 10px;
    padding: 4px 0;
    color: var(--os9-ink);
}

.os9-cs-body {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: linear-gradient(to bottom, #eeeeee, #cccccc);
    border: 1px solid #000;
    border-left: none;
    border-radius: 0 3px 3px 0;
    overflow-x: auto;
}

.os9-control-strip.collapsed .os9-cs-body {
    display: none;
}

.os9-cs-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    white-space: nowrap;
}

.os9-cs-item input[type="range"] {
    width: 72px;
}

.os9-cs-item select {
    font-size: 10px;
    font-family: var(--os9-font);
}

/* VHS panel inherits page buttons */
.vhs-panel {
    margin: 0.5em auto;
    max-width: 28em;
    text-align: left;
    font-size: 12px;
}
.vhs-enable-row { text-align: center; margin-bottom: 0.4em; }
.vhs-panel-body {
    display: none;
    background: var(--os9-platinum);
    border: 1px solid var(--os9-darker);
    padding: 0.5em 0.6em;
    max-height: 22em;
    overflow-y: auto;
}
.vhs-panel-on .vhs-panel-body { display: block; }
.vhs-hint { font-size: 11px; margin-bottom: 0.4em; color: #333; }
.vhs-ctrl-row { display: flex; align-items: center; gap: 0.35em; margin: 0.25em 0; }
.vhs-ctrl-name { flex: 0 0 7.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vhs-ctrl-row input[type="range"] { flex: 1 1 auto; min-width: 0; }
.vhs-ctrl-row input[type="number"] { width: 4em; box-sizing: border-box; }
.vhs-tools { margin-top: 0.5em; text-align: center; }
.vhs-tools button { margin: 0.15em; }
.vhs-tools label { display: inline-block; margin-right: 0.6em; }

.os9-links {
    margin: 12px 0;
    font-size: 12px;
}
.os9-links a { color: #0000ee; }

@media (max-width: 640px) {
    #jw_os9 { width: 92%; }
    .os9-desktop-icons { display: none; }
    .os9-control-strip { left: 4px; right: 4px; }
}
