/* ライトテーマ専用の追加変数（テーマ共通変数は /theme.css から注入される） */
:root[data-theme="light"] {
    --backdrop-bg: rgba(17, 24, 39, 0.35);
    --dialog-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
    --remote-access-bg: #f59e0b;
    --remote-access-text: #111827;
    color-scheme: light;
}

/* ダークテーマ専用の追加変数 */
:root[data-theme="dark"] {
    --backdrop-bg: rgba(0, 0, 0, 0.5);
    --dialog-shadow: 0 18px 50px rgba(0, 0, 0, 0.46);
    --remote-access-bg: #d97706;
    --remote-access-text: #fffbeb;
    color-scheme: dark;
}

/* 全要素でpadding/borderをwidthに含めて寸法計算を簡素化 */
* {
    box-sizing: border-box;
    scrollbar-color: var(--scrollbar-handle-bg) transparent;
    scrollbar-width: thin;
}

/* モーダルや入力欄を含む全画面で、OS標準の明るいスクロールバーがテーマから浮かないよう統一する。 */
*::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-handle-bg);
    background-clip: padding-box;
    border: 3px solid transparent;
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
    background-color: var(--scrollbar-handle-hover-bg);
}

*::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

/* ネイティブ描画が残る入力部品もテーマ色を基準にし、画面ごとの色指定漏れを目立たせない。 */
input {
    accent-color: var(--primary-bg);
}

input::placeholder,
textarea::placeholder {
    color: var(--disabled-text);
    opacity: 1;
}

/* 全画面をPC向けの表示幅に統一し、狭い端末でもレイアウトを組み替えず表示する。 */
html, body {
    height: 100%;
    min-width: 1280px;
}

/* 画面全体のベーススタイル（縦方向にヘッダー+本体を積む） */
body {
    margin: 0;
    background: var(--window-bg);
    color: var(--window-text);
    font-family: "Segoe UI", "Yu Gothic UI", sans-serif;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 上部ヘッダーバー（左スロット・タイトル・テーマ切替を横並び） */
.window-header {
    display: flex;
    align-items: center;
    height: 38px;
    padding: 0 4px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    flex-shrink: 0;
}

/* ヘッダー中央のタイトルテキスト */
.window-title {
    flex: 1;
    min-width: 0;
    margin-left: 8px;
    color: var(--title-text);
    font-size: 18px;
    font-weight: 700;
}

/* 端末名が長くても右端の共通操作を押し出さず、現在の接続名だけを常に確認できるようにする。 */
.header-device-name {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 280px;
    min-width: 0;
    margin-left: 12px;
    padding: 0 8px;
    color: var(--subheading-text);
    font-size: 12px;
}

.header-device-name span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-device-name svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

/* ヘッダー両端のアイコンボタン共通スタイル */
.header-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 30px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--header-icon);
}

.header-button:hover {
    background-color: var(--header-button-hover-bg);
}

.header-button:active {
    background-color: var(--header-button-pressed-bg);
}

.header-button svg {
    width: 18px;
    height: 18px;
}

/* 画面下部に共通バージョンを薄く表示 */
.app-version-footer {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    flex-shrink: 0;
    padding: 4px 8px 6px;
    background: var(--body-bg);
    color: var(--subheading-text);
    font-size: 11px;
    font-weight: 400;
    text-align: center;
}

.app-version-label {
    grid-column: 2;
}

/* 遠隔画面では操作先が手元のPCではないことを、常時見える色と文言で示す。 */
.app-version-footer.is-remote-access {
    background: var(--remote-access-bg);
    color: var(--remote-access-text);
}

.app-remote-access-label {
    grid-column: 3;
    justify-self: end;
    font-weight: 600;
}
