#app-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  background:
    url('../img/digital_tile_overlay.png') repeat,
    #3d6f44;
}

#app-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('../img/vignete.png') center center / cover no-repeat;
  opacity: 0.7; /* Adjust this value: 0.3 for more transparent, 0.7 for less */
}

/* Ensure no scrollbars appear */
body {
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevent scrollbars */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh; /* Full viewport height */
    background-color: black; /* Match the app background */
}

.container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.display {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 24px;
    padding: 10px;
    box-sizing: border-box;
    overflow: hidden;
}

/* Responsive SVG container */
#digits {
    width: 100%;
    height: auto;
    max-width: calc(100vw - 20px);
    max-height: 80vh;
    display: block;
}

/* Additional mobile responsiveness */
@media (max-width: 768px) {
    #digits {
        max-width: calc(100vw - 10px);
        max-height: 70vh;
    }
}

@media (max-width: 480px) {
    #digits {
        max-width: calc(100vw - 10px);
        max-height: 60vh;
    }
    
    .display {
        padding: 5px;
    }
}
/* segment styling - applies to paths with .segment and the legacy id-based styling */
#digits path,
.segment {
  fill: #56be54;
  fill-opacity: 0.1;
  transition: fill-opacity 0.4s;
}
.segment.on,
#digits path.on {
  fill-opacity: 0.8;
  transition: fill-opacity 0.4s;
}

/* separator styling */
.separator {
  fill: #56be54;
  fill-opacity: 0.8;
}

/* Settings Icon */
.settings-icon {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 24px;
    height: 24px;
    color: #56be54;
    opacity: 0.1;
    cursor: pointer;
    transition: opacity 0.3s ease;
    z-index: 1000;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-icon:hover,
.settings-icon:focus {
    opacity: 0.8;
    background-color: rgba(86, 190, 84, 0.1);
}

/* Touch device support */
@media (hover: none) {
    .settings-icon:active {
        opacity: 0.8;
        background-color: rgba(86, 190, 84, 0.1);
    }
}

/* Settings Dialog */
.settings-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    box-sizing: border-box;
}

.settings-dialog.open {
    display: flex;
}

.settings-content {
    background-color: #1a1a1a;
    border: 2px solid #56be54;
    border-radius: 8px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    color: #56be54;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #56be54;
}

.settings-header h2 {
    margin: 0;
    font-family: monospace;
    font-size: 1.5em;
    color: #56be54;
}

.close-btn {
    background: none;
    border: none;
    color: #56be54;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.close-btn:hover,
.close-btn:focus {
    background-color: rgba(86, 190, 84, 0.1);
}

.settings-body {
    padding: 20px;
    font-family: monospace;
    line-height: 1.6;
}

.settings-body p {
    margin: 0 0 15px 0;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

.settings-dropdown,
.theme-dropdown {
    width: 100%;
    padding: 8px 12px;
    background-color: #2a2a2a;
    border: 1px solid #56be54;
    border-radius: 4px;
    color: #56be54;
    font-family: monospace;
    font-size: 14px;
    cursor: pointer;
}

.settings-dropdown:focus,
.theme-dropdown:focus {
    outline: none;
    border-color: #7dd87f;
    box-shadow: 0 0 5px rgba(86, 190, 84, 0.3);
}

.settings-dropdown option,
.theme-dropdown option {
    background-color: #2a2a2a;
    color: #56be54;
}

.settings-input {
    width: 100%;
    padding: 8px 12px;
    background-color: #2a2a2a;
    border: 1px solid #56be54;
    border-radius: 4px;
    color: #56be54;
    font-family: monospace;
    font-size: 14px;
    box-sizing: border-box;
}

.settings-input:focus {
    outline: none;
    border-color: #7dd87f;
    box-shadow: 0 0 5px rgba(86, 190, 84, 0.3);
}

.settings-input::placeholder {
    color: #777;
}

.setting-hint {
    font-size: 0.8em;
    color: #999;
    margin-top: 4px;
    font-style: italic;
}

.mode-settings {
    display: none;
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #444;
    border-radius: 4px;
    background-color: rgba(86, 190, 84, 0.05);
}

.mode-settings.active {
    display: block;
}

.apply-btn {
    width: 100%;
    padding: 12px;
    background-color: #56be54;
    border: none;
    border-radius: 4px;
    color: #000;
    font-family: monospace;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.apply-btn:hover,
.apply-btn:focus {
    background-color: #7dd87f;
    outline: none;
}

.apply-btn:active {
    background-color: #4a9f48;
}

.settings-note {
    font-size: 0.9em;
    opacity: 0.7;
    font-style: italic;
}

/* Mobile responsiveness for settings */
@media (max-width: 480px) {
    .settings-icon {
        top: 15px;
        right: 15px;
    }
    
    .settings-dialog {
        padding: 10px;
    }
    
    .settings-content {
        max-width: 100%;
    }
    
    .settings-header,
    .settings-body {
        padding: 15px;
    }
}

/* ============================================
   THEME OVERRIDES
   ============================================ */

/* Grayscale Theme */
body.theme-grayscale {
    /* Override green colors with grayscale equivalents */
}

body.theme-grayscale #app-bg {
    background: 
        url('../img/digital_tile_overlay.png') repeat,
        #404040;
}

body.theme-grayscale #digits path,
body.theme-grayscale .segment {
    fill: #cccccc;
}

body.theme-grayscale .segment.on,
body.theme-grayscale #digits path.on {
    fill-opacity: 0.9;
}

body.theme-grayscale .separator {
    fill: #cccccc;
}

body.theme-grayscale .settings-icon {
    color: #cccccc;
}

body.theme-grayscale .settings-icon:hover,
body.theme-grayscale .settings-icon:focus {
    background-color: rgba(204, 204, 204, 0.1);
}

body.theme-grayscale .settings-content {
    border-color: #cccccc;
}

body.theme-grayscale .settings-header {
    border-bottom-color: #cccccc;
}

body.theme-grayscale .settings-header h2,
body.theme-grayscale .settings-body,
body.theme-grayscale .close-btn {
    color: #cccccc;
}

body.theme-grayscale .close-btn:hover,
body.theme-grayscale .close-btn:focus {
    background-color: rgba(204, 204, 204, 0.1);
}

body.theme-grayscale .settings-dropdown,
body.theme-grayscale .theme-dropdown {
    border-color: #cccccc;
    color: #cccccc;
}

body.theme-grayscale .settings-dropdown:focus,
body.theme-grayscale .theme-dropdown:focus {
    border-color: #ffffff;
    box-shadow: 0 0 5px rgba(204, 204, 204, 0.3);
}

body.theme-grayscale .settings-dropdown option,
body.theme-grayscale .theme-dropdown option {
    color: #cccccc;
}

body.theme-grayscale .settings-input {
    border-color: #cccccc;
    color: #cccccc;
}

body.theme-grayscale .settings-input:focus {
    border-color: #ffffff;
    box-shadow: 0 0 5px rgba(204, 204, 204, 0.3);
}

body.theme-grayscale .settings-input::placeholder {
    color: #666;
}

body.theme-grayscale .setting-hint {
    color: #888;
}

body.theme-grayscale .mode-settings {
    border-color: #666;
    background-color: rgba(204, 204, 204, 0.05);
}

body.theme-grayscale .apply-btn {
    background-color: #cccccc;
    color: #000;
}

body.theme-grayscale .apply-btn:hover,
body.theme-grayscale .apply-btn:focus {
    background-color: #ffffff;
}

body.theme-grayscale .apply-btn:active {
    background-color: #999;
}

/* Touch device support for grayscale theme */
@media (hover: none) {
    body.theme-grayscale .settings-icon:active {
        background-color: rgba(204, 204, 204, 0.1);
    }
}
