body {
    margin: 0;
    font-family: sans-serif;
    background-color: #333;
    color: #eee;
    overflow: hidden;
    /* Prevent scrollbars from showing up by default */
}

.desktop {
    width: 100vw;
    height: 100vh;
    position: relative;
    background-color: #2e2e2e;
    /* Darker background for the desktop */
}

/* Panel (Taskbar) */
.panel {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background: linear-gradient(to bottom, #4c4c4c, #333);
    border-top: 1px solid #555;
    display: flex;
    align-items: center;
    padding: 0 10px;
    box-sizing: border-box;
    font-size: 0.8em;
}

.menu-button {
    background-color: #5f5;
    /* Enlightenment green */
    color: #333;
    padding: 3px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.5);
}

.tasks {
    flex-grow: 1;
    display: flex;
    margin-left: 10px;
}

.task-item {
    background-color: #444;
    border: 1px solid #555;
    padding: 3px 8px;
    margin-right: 5px;
    border-radius: 3px;
    cursor: pointer;
}

.task-item.active {
    background: linear-gradient(to bottom, #777, #555);
    border-color: #888;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
    color: #fff;
}

.system-tray .clock {
    margin-left: auto;
    background-color: #444;
    padding: 3px 8px;
    border-radius: 3px;
    border: 1px solid #555;
}

/* Windows */
.window {
    position: absolute;
    background-color: #444;
    border: 1px solid #666;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    resize: both;
    /* Allow resizing */
    min-width: 150px;
    min-height: 100px;
    display: flex;
    flex-direction: column;
}

.window.active {
    z-index: 100;
    /* Bring active window to front */
    border-color: #5f5;
    /* Green border for active window */
}

.window-header,
.title-bar {
    background: linear-gradient(to bottom, #666, #4c4c4c);
    padding: 5px 10px;
    border-bottom: 1px solid #777;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
    /* Indicates draggable header */
}

.window.active .window-header {
    background: linear-gradient(to bottom, #5f5, #3c3);
    /* Active window header green */
    border-bottom-color: #8f8;
    color: #333;
}

.window.active .window-header .window-title,
.window.active .title-bar .title-bar-text {
    color: #333;
}


.window-title,
.title-bar-text {
    font-weight: bold;
    color: #eee;
    font-size: 0.9em;
}

.window-controls {
    display: flex;
}

.window-controls button {
    background-color: #555;
    border: 1px solid #777;
    width: 18px;
    height: 18px;
    margin-left: 3px;
    border-radius: 3px;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    color: transparent;
    /* Hide default button text */
    font-size: 0;
    padding: 0;
}

/* Generic Button Support */
button {
    background: linear-gradient(to bottom, #555, #444);
    border: 1px solid #777;
    color: #eee;
    padding: 4px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
    font-family: inherit;
    font-size: 13px;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1) inset;
    margin: 2px;
}

button:hover {
    background: linear-gradient(to bottom, #666, #555);
}

button:active {
    background: linear-gradient(to bottom, #444, #333);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

button.default {
    background: linear-gradient(to bottom, #5f5, #3c3);
    border-color: #8f8;
    color: #333;
    box-shadow: 0 0 5px rgba(95, 255, 95, 0.5);
}

button:disabled {
    opacity: 0.5;
    cursor: default;
    background: #444;
}

.window-controls button::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 2px;
    background-color: #ccc;
    transform: translateY(0px);
}

.window-controls .minimize::before {
    width: 10px;
    height: 2px;
    background-color: #ccc;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.window-controls .maximize::before {
    width: 8px;
    height: 8px;
    border: 1px solid #ccc;
    background: none;
    top: 4px;
    left: 4px;
    transform: none;
}

.window-controls .close {
    background-color: #d00;
    border-color: #f33;
}

.window-controls .close::before {
    background-color: #fff;
    transform: rotate(45deg);
}

.window-controls .close::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 2px;
    background-color: #fff;
    transform: rotate(-45deg);
}


.window-content {
    flex-grow: 1;
    padding: 10px;
    background-color: #3d3d3d;
    /* Lighter background for content area */
    overflow: auto;
}

/* Common Window Elements */
.window-body {
    flex-grow: 1;
    padding: 12px;
    overflow: auto;
}

/* Form Elements */
fieldset {
    border: 1px solid #5f5;
    border-radius: 5px;
    padding: 15px;
    margin: 10px 0;
    background-color: rgba(95, 255, 95, 0.05);
}

legend {
    color: #5f5;
    font-weight: bold;
    padding: 0 10px;
    font-size: 0.9em;
}

input[type="text"] {
    background-color: #2e2e2e;
    border: 1px solid #777;
    color: #eee;
    padding: 5px 8px;
    border-radius: 3px;
    font-family: inherit;
}

input[type="text"]:focus {
    border-color: #5f5;
    outline: none;
    box-shadow: 0 0 3px #5f5;
}

label {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    cursor: pointer;
    gap: 8px;
    font-size: 0.9em;
}

/* Checkbox and Radio */
input[type="checkbox"],
input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid #777;
    background-color: #444;
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
    background-color: #5f5;
    border-color: #8f8;
}

input[type="checkbox"]:checked::after {
    content: '✓';
    color: #333;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
}

input[type="radio"] {
    border-radius: 50%;
}

input[type="radio"]:checked::after {
    content: '';
    width: 6px;
    height: 6px;
    background-color: #333;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Desktop Icons */
.icon-grid {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    width: 60px;
    /* Adjust as needed */
}

.desktop-icon img {
    width: 32px;
    height: 32px;
    margin-bottom: 5px;
    border: 1px solid #555;
    background-color: #444;
    border-radius: 3px;
}

.desktop-icon span {
    font-size: 0.75em;
    color: #eee;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.7);
}

.desktop-icon:hover {
    background-color: rgba(95, 255, 95, 0.2);
    /* Light green hover */
    border-radius: 5px;
}

/* File Manager Window Specific Styles */
.file-manager-window .sidebar-item {
    padding: 5px;
    margin-bottom: 5px;
    cursor: pointer;
    border-radius: 3px;
}

.file-manager-window .sidebar-item:hover {
    background-color: #555;
}

.file-manager-window .sidebar-item.active {
    background-color: #5f5;
    color: #333;
    font-weight: bold;
}

.file-manager-window .file-item:hover {
    background-color: rgba(95, 255, 95, 0.2);
    border-radius: 3px;
}

/* Settings Window Specific Styles */
.settings-window .tabs-nav .tab-item {
    padding: 5px 8px;
    margin-bottom: 5px;
    cursor: pointer;
    border-radius: 3px;
    color: #ccc;
}

.settings-window .tabs-nav .tab-item:hover {
    background-color: #555;
}

.settings-window .tabs-nav .tab-item.active {
    background-color: #5f5;
    color: #333;
    font-weight: bold;
}

.settings-window h3 {
    color: #eee;
    margin-top: 0;
    margin-bottom: 10px;
    border-bottom: 1px solid #5f5;
    padding-bottom: 5px;
}

.settings-window label {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    cursor: pointer;
}

.settings-window input[type="checkbox"],
.settings-window input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid #777;
    background-color: #444;
    border-radius: 3px;
    margin-right: 8px;
    position: relative;
    cursor: pointer;
}

.settings-window input[type="checkbox"]:checked,
.settings-window input[type="radio"]:checked {
    background-color: #5f5;
    border-color: #8f8;
}

.settings-window input[type="checkbox"]:checked::after {
    content: '✓';
    color: #333;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
}

.settings-window input[type="radio"] {
    border-radius: 50%;
    /* 丸いラジオボタン */
}

.settings-window input[type="radio"]:checked::after {
    content: '';
    width: 8px;
    height: 8px;
    background-color: #333;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.settings-window input[type="range"] {
    width: 100%;
    height: 5px;
    background: #555;
    border-radius: 3px;
    appearance: none;
    -webkit-appearance: none;
    margin: 10px 0;
}

.settings-window input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #5f5;
    cursor: pointer;
    border: 1px solid #8f8;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.settings-window input[type="range"]::-moz-range-thumb {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #5f5;
    cursor: pointer;
    border: 1px solid #8f8;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Dialog Styles */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    /* Ensure dialog is on top of everything */
}

.dialog {
    background-color: #444;
    border: 1px solid #666;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.7);
    width: 350px;
    color: #eee;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dialog-header {
    background: linear-gradient(to bottom, #666, #4c4c4c);
    padding: 5px 10px;
    border-bottom: 1px solid #777;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

.dialog-title {
    font-size: 0.9em;
}

.dialog-close-button {
    background: none;
    border: none;
    color: #ccc;
    font-size: 1.2em;
    cursor: pointer;
    padding: 0 5px;
}

.dialog-close-button:hover {
    color: #fff;
}

.dialog-content {
    padding: 15px;
    background-color: #3d3d3d;
    flex-grow: 1;
}

.dialog-footer {
    background-color: #4c4c4c;
    border-top: 1px solid #555;
    padding: 10px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.dialog-button {
    background: linear-gradient(to bottom, #555, #444);
    border: 1px solid #777;
    color: #eee;
    padding: 5px 15px;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset;
}

.dialog-button:hover {
    background: linear-gradient(to bottom, #666, #555);
}

.dialog-button.ok-button {
    background: linear-gradient(to bottom, #5f5, #3c3);
    border-color: #8f8;
    color: #333;
}

.dialog-button.ok-button:hover {
    background: linear-gradient(to bottom, #6f6, #4d4);
}

.dialog-button.cancel-button {
    background: linear-gradient(to bottom, #d00, #a00);
    border-color: #f33;
}

.dialog-button.cancel-button:hover {
    background: linear-gradient(to bottom, #e11, #b11);
}

/* Context Menu Styles */
.context-menu {
    position: fixed;
    background-color: #444;
    border: 1px solid #666;
    border-radius: 3px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.7);
    padding: 5px 0;
    z-index: 1000;
    /* Above windows and dialogs */
    min-width: 180px;
}

.context-menu .menu-item {
    padding: 5px 15px;
    color: #eee;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.context-menu .menu-item:hover {
    background-color: #5f5;
    /* Enlightenment green hover */
    color: #333;
}

.context-menu .menu-item.disabled {
    color: #888;
    cursor: not-allowed;
}

.context-menu .menu-separator {
    height: 1px;
    background-color: #555;
    margin: 5px 0;
}

.context-menu .menu-item .arrow {
    font-size: 0.8em;
    color: #ccc;
}

.context-menu .menu-item:hover .arrow {
    color: #333;
}

.context-menu .sub-menu {
    position: absolute;
    left: 100%;
    top: -5px;
    /* Align with parent menu item */
    background-color: #444;
    border: 1px solid #666;
    border-radius: 3px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.7);
    padding: 5px 0;
    min-width: 150px;
    display: none;
    /* Hidden by default */
}

/* Show sub-menu on hover */
.context-menu .menu-item:hover>.sub-menu {
    display: block;
}