:root {
  --bg-primary: #008080;
  --titlebar-dark: #0d2a53;
  --titlebar-light: #f0f0f0;
  --text-dark: #cccccc;
  --text-light: #000000;
  --context-menu-bg: #0d2a53;
  --border-gray: #707070;
  --hover-dark: #2a4a7a;
  --close-hover: #e81123;
  --titlebar-height: 20px;
  --resizer-size: 8px;
  --window-min-width: 350px;
  --window-min-height: 200px;
  --console-bg: #000000;
  --scrollbar-track: #2c2c2c;
  --scrollbar-thumb: #555;
}

@font-face {
  font-family: 'MS Gothic';
  src: local('MS Gothic'),
       local('ＭＳ ゴシック'),
       local('Osaka-mono');
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  background-color: var(--bg-primary);
  font-family: 'MS Gothic', 'Osaka-mono', monospace;
}

.window-container {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: var(--window-min-width);
  min-height: var(--window-min-height);
  border: 1px solid var(--border-gray);
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.window-container.maximized {
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    border: none;
    box-shadow: none;
    transition: none;
}
.window-container.snapped-left {
    top: 0 !important;
    left: 0 !important;
    width: 50vw !important;
    height: 100vh !important;
}
.window-container.snapped-right {
    top: 0 !important;
    left: 50vw !important;
    width: 50vw !important;
    height: 100vh !important;
}

.console-window {
    width: 700px;
    height: 450px;
    background-color: var(--console-bg);
}
.explorer-window {
    width: 800px;
    height: 550px;
    background-color: var(--titlebar-light);
}
.notepad-window {
    width: 750px;
    height: 500px;
    background-color: var(--titlebar-light);
}
.file-explorer-dialog-window {
    width: 580px;
    height: 420px;
    background-color: var(--titlebar-light);
}

.title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 5px;
  background-color: var(--titlebar-dark);
  color: var(--text-dark);
  font-size: 14px;
  cursor: move;
  user-select: none;
  flex-shrink: 0;
}
.maximized .title-bar,
.snapped-left .title-bar,
.snapped-right .title-bar {
    cursor: default;
}

.explorer-window .title-bar,
.notepad-window .title-bar,
.file-explorer-dialog-window .title-bar
.event-viewer-window .title-bar {
    background-color: var(--titlebar-light);
    color: var(--text-light);
    border-bottom: 1px solid #ccc;
}

.title-bar-text {
  display: flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-bar-icon {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  background-repeat: no-repeat;
  background-size: contain;
  cursor: pointer;
}

.icon-console {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="%23fff"><path d="M2 2v2h12V2H2zm0 3v2h12V5H2zm0 3v2h12V8H2zm0 3v2h12v-2H2z"/></svg>');
}
.icon-explorer,
.icon-file_explorer_dialog {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="%23000"><path d="M13 2H3v2h10V2zm0 3H3v2h10V5zm0 3H3v2h10V8zM3 11h5v2H3v-2z"/></svg>');
}
.icon-notepad {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="%23000"><path d="M9 1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4l-4-3zm2 9H5v-1h6v1zm0-2H5V7h6v1zm-1-3V2.5L13.5 6H10z"/></svg>');
}

.window-controls {
  display: flex;
}
.window-controls span {
    width: 26px;
    height: var(--titlebar-height);
    margin-left: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-weight: bold;
    color: var(--text-dark);
    cursor: pointer;
    transition: background-color 0.15s;
}
.window-controls span:hover {
      background-color: var(--hover-dark);
}
.window-controls span.close-btn:hover {
      background-color: var(--close-hover);
      color: white;
}

.explorer-window .window-controls span,
.notepad-window .window-controls span,
.file-explorer-dialog-window .window-controls span {
    color: var(--text-light);
}
.explorer-window .window-controls span:hover,
.notepad-window .window-controls span:hover,
.file-explorer-dialog-window .window-controls span:hover {
      background-color: #e0e0e0;
}
.explorer-window .window-controls span.close-btn:hover,
.notepad-window .window-controls span.close-btn:hover,
.file-explorer-dialog-window .window-controls span.close-btn:hover {
      background-color: var(--close-hover);
      color: white;
}

.window-content-frame {
  width: 100%;
  height: 100%;
  flex-grow: 1;
  border: none;
  background-color: #FFFFFF;
}

.console-body {
  padding: 8px;
  flex-grow: 1;
  overflow-y: auto;
  color: #c0c0c0;
  font-size: 16px;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
}

.console-body::-webkit-scrollbar {
  width: 16px;
}
.console-body::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
.console-body::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border: 1px solid #777;
}

.console-output {
}

.console-output > div {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.input-line {
  display: flex;
}

.input-line.interactive-mode .prompt {
  display: none;
}

.prompt {
  white-space: pre;
  color: #c0c0c0;
}

.console-input {
  flex-grow: 1;
  background: none;
  border: none;
  outline: none;
  padding: 0;
  font: inherit;
  color: #c0c0c0;
  caret-color: #c0c0c0;
}

.cmd { color: #4CAF50; }
.error { color: #ff5555; }

#minimized-area {
  position: fixed;
  bottom: 5px;
  left: 5px;
  display: flex;
  z-index: 10000;
}

.minimized-tab {
  height: 28px;
  max-width: 250px;
  padding: 0 8px;
  margin: 0 2px;
  display: flex;
  align-items: center;
  background-color: #c0c0c0;
  border: 2px solid #ffffff;
  border-right-color: #808080;
  border-bottom-color: #808080;
  box-shadow: 1px 1px 1px #808080;
  color: #000;
  font-weight: bold;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.minimized-tab:active {
    border-color: #808080;
    border-right-color: #ffffff;
    border-bottom-color: #ffffff;
}

.resizer {
  position: absolute;
  background: transparent;
  z-index: 10;
}

.top { top: -4px; left: 0; width: 100%; height: var(--resizer-size); cursor: ns-resize; }
.right { top: 0; right: -4px; width: var(--resizer-size); height: 100%; cursor: ew-resize; }
.bottom { bottom: -4px; left: 0; width: 100%; height: var(--resizer-size); cursor: ns-resize; }
.left { top: 0; left: -4px; width: var(--resizer-size); height: 100%; cursor: ew-resize; }
.top-left { top: -6px; left: -6px; width: 12px; height: 12px; cursor: nwse-resize; }
.top-right { top: -6px; right: -6px; width: 12px; height: 12px; cursor: nesw-resize; }
.bottom-left { bottom: -6px; left: -6px; width: 12px; height: 12px; cursor: nesw-resize; }
.bottom-right { bottom: -6px; right: -6px; width: 12px; height: 12px; cursor: nwse-resize; }

.snap-indicator {
  position: fixed;
  z-index: 99999;
  pointer-events: none;
  border: 2px solid #fff;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.11);
  transition: all 0.1s ease-in-out;
}

#context-menu-container {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10001;
}

.custom-context-menu {
  position: absolute;
  min-width: 180px;
  background: var(--context-menu-bg);
  border: 1.5px solid var(--border-gray);
  box-shadow: 1px 2px 8px rgba(0, 0, 0, 0.4);
  font-family: 'MS Gothic', 'Osaka-mono', monospace;
  color: var(--text-dark);
  padding: 4px 0;
  margin: 0;
  font-size: 14px;
}
.custom-context-menu .menu-item {
    padding: 6px 20px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
    position: relative;
}
.custom-context-menu .menu-item:hover {
      background-color: var(--hover-dark);
}
.custom-context-menu .separator {
    height: 1px;
    background-color: var(--border-gray);
    margin: 4px 0;
}

.window-switcher-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(20, 20, 20, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#window-switcher-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: flex-start;
    gap: 10px;
    padding: 15px;
    list-style: none;
    margin: 0;
    max-width: 90vw;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: #555 #333;
}

#window-switcher-list::-webkit-scrollbar { height: 6px; }
#window-switcher-list::-webkit-scrollbar-track { background: #333; border-radius: 3px; }
#window-switcher-list::-webkit-scrollbar-thumb { background-color: #555; border-radius: 3px; }

.window-switcher-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    border: 2px solid transparent;
    border-radius: 2px;
    cursor: pointer;
    background-color: rgba(40, 40, 40, 0.6);
    transition: background-color 0.15s, border-color 0.15s;
    width: 200px;
    height: 160px;
    padding: 8px;
    box-sizing: border-box;
    overflow: hidden;
}

.window-switcher-item.selected {
    background-color: rgba(80, 80, 80, 0.7);
    border-color: #0078d4;
}

.window-switcher-item .thumbnail {
    width: 100%;
    height: 110px;
    margin-bottom: 8px;
    background-color: #000;
    border: 1px solid #555;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.window-switcher-item .thumbnail .window-clone {
    position: absolute;
    transform-origin: top left;
    pointer-events: none;
}

.window-switcher-item .title {
    color: white;
    font-family: 'Segoe UI', 'Meiryo', sans-serif;
    font-size: 13px;
    font-weight: normal;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
}

#privacy-policy-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #aa0000;
    color: #FFFFFF;
    font-family: 'MS Gothic', 'Osaka-mono', monospace;
    font-size: 16px;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}
#privacy-policy-overlay .bios-screen {
    width: 90%;
    max-width: 800px;
    height: 90%;
    max-height: 600px;
    background: #0000AA;
    border: 2px solid #FFFFFF;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
}
#privacy-policy-overlay .bios-header {
    background-color: #888888;
    color: #FFFFFF;
    text-align: center;
    padding: 0.2rem 0;
    margin-bottom: 1rem;
    font-weight: bold;
    flex-shrink: 0;
}
#privacy-policy-overlay .bios-footer {
    background-color: #888888;
    color: #FFFFFF;
    text-align: center;
    padding: 0.5rem 0;
    margin-top: 1rem;
    font-weight: bold;
    flex-shrink: 0;
}
#privacy-policy-overlay .privacy-content {
    flex-grow: 1;
    overflow-y: scroll;
    border: 1px solid #fff;
    padding: 1rem;
    background-color: #000080;
    outline: none;
    white-space: pre-wrap;
}
#privacy-policy-overlay .privacy-content::-webkit-scrollbar {
  width: 16px;
}
#privacy-policy-overlay .privacy-content::-webkit-scrollbar-track {
  background: #0000AA;
}
#privacy-policy-overlay .privacy-content::-webkit-scrollbar-thumb {
  background: #c0c0c0;
  border: 1px solid #fff;
}
#privacy-policy-overlay button {
    padding: 0.5rem 2rem;
    background: #888888;
    color: #FFFFFF;
    border: 1px solid #FFFFFF;
    font-size: 1rem;
    cursor: pointer;
    font-family: inherit;
}
#privacy-policy-overlay button:disabled {
    opacity: 0.5;
    cursor: default;
}
#privacy-policy-overlay button:focus, #privacy-policy-overlay button:not(:disabled):hover {
    background: #FFFFFF;
    color: #0000AA;
}

.custom-context-menu.light {
    background: var(--titlebar-light);
    color: var(--text-light);
    border-color: #A0A0A0;
}

.custom-context-menu.light .menu-item:hover {
      background-color: #e0e0e0;
}

.custom-context-menu.light .separator {
    background-color: #cccccc;
}

.event-viewer-window .title-bar {
    background-color: var(--titlebar-light);
    color: var(--text-light);
    border-bottom: 1px solid #ccc;
}

.event-viewer-window .window-controls span {
    color: var(--text-light);
}

.event-viewer-window .window-controls span:hover {
    background-color: #e0e0e0;
}

.event-viewer-window .window-controls span.close-btn:hover {
    background-color: var(--close-hover);
    color: white;
}