body {
    margin: 0;
    padding: 0;
}

#app-div * {
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
}

#app-div {
    font-family: system-ui, Arial, sans-serif;
    background: whitesmoke;
    color: #222;
    margin: 5rem auto 0 auto;
    padding: 1rem 0 0 0;
    height: 340px;
    width: 400px;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    box-sizing: border-box;
    border-radius: 0.7rem;
}

/* Wake the lock status indicator class */
.status-indicator {
    position: fixed;
    top: 5.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 144, 255, 0.9);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 40;
    backdrop-filter: blur(10px);
    transition: opacity 0.3s ease;
}
.status-indicator.fade-out {
    opacity: 0;
}

#menu-bar {
    position: fixed;
    top: 0.5rem;
    left: 0.5rem;
    right: 0.5rem;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: silver;
    border-radius: 0.7rem;
}

#right-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#language-select {
    height: 2.2rem;
    padding: 0 0.6rem;
    border-radius: 0.5rem;
    border: 2px solid dodgerblue;
    background: white;
    color: #222;
    font-size: 1rem;
}

#site-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    font-size: 2rem;
    font-weight: bold;
    text-align: center;
    pointer-events: none;
}

#menu-btn {
    height: 4rem;
    width: 4rem;
    background: white;
    border: 2px solid dodgerblue;
    border-radius: 0.7rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

#menu-btn-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#menu-list {
    position: absolute;
    top: 4rem;
    left: 0;
    z-index: 60;
    background: white;
    min-width: 120px;
    border: 2px solid dodgerblue;
    border-radius: 0.7rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
}

.menu-option {
    font-size: 1.3rem;
    padding: 0.7rem 0.7rem;
    cursor: pointer;
    background: none;
    border: none;
    border-radius: inherit;
    text-align: left;
    color: black;
}
.menu-option:hover, .menu-option:focus {
    background: aliceblue;
    color: dodgerblue;
}

/* Wake lock toggle menu item */
#wake-lock-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem; /* Minimum space between spans */
}

#wake-lock-toggle-status {
    font-weight: bold;
    color: #28a745;
}

#wake-lock-toggle-status.off {
    color: #dc3545;
}

#wake-lock-toggle-status.disabled {
    color: #6c757d;
    font-style: italic;
}

#color-mode-toggle {
    height: 3rem;
    width: 3rem;
    background: none;
    border: none;
    border-radius: 0.7rem;
    padding: 0.25rem;
    cursor: pointer;
}
#color-mode-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

body.dark-mode {
    background: black;
    color: white;
}
body.dark-mode #menu-bar {
    background-color: rgb(83, 83, 83);
}
body.dark-mode #menu-bar #menu-list {
    background-color: lightsteelblue;
}
body.dark-mode #language-select {
    background: white;
    color: #222;
    border-color: dodgerblue;
}
body.dark-mode #app-div {
    background-color: lightgray;
}
body.dark-mode #sound-switcher #sound-select-btn {
    background-color: lightsteelblue;
}
body.dark-mode #sound-switcher #sound-list {
    background-color: lightsteelblue;
}
body.dark-mode #play-btn {
    background: darkgray;
    border-color: black;
}
body.dark-mode #qa-section {
    background: lightgray;
}
body.dark-mode #scenarios-section {
    background: lightgray;
}
body.dark-mode section details div {
    background: lightyellow;
}
body.dark-mode #color-mode-toggle {
    background: white;
}
body.dark-mode .modal .modal-content {
    background: black;
    border-color: white;
    border-width: 2px;
    border-style: solid;
}

main {
    width: 350px;
    margin: 0 auto;
    padding: 0.5rem 1rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}
#play-btn {
    background: white;
    border: 2px solid silver;
    border-radius: 2rem;
    width: 70%;
    max-width: 340px;
    height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-bottom: 1rem;
}
#play-btn:active {
    border-color: dodgerblue;
    background: aliceblue;
}
#play-icon {
    font-size: 4rem;
    pointer-events: none;
}
#play-btn.clapping #play-icon {
    transform: scale(1.2) rotate(-10deg);
}

#controls {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    justify-content: center;
}
#speed-label-slow {
    font-size: 1.1rem;
    color: dodgerblue;
    font-weight: 500;
    margin-right: 0.5rem;
    min-width: 2.5em;
    text-align: right;
}
#speed-label-fast {
    font-size: 1.1rem;
    color: darkorange;
    font-weight: 500;
    margin-left: 0.5rem;
    min-width: 2.5em;
    text-align: left;
}

#speed {
  appearance: none;
  width: 100%;
  height: 25px;
  outline: none;
  opacity: 0.7;
}

#speed::-webkit-slider-runnable-track {
    height: 25px;
    border-radius: 8px;
    background: linear-gradient(90deg, dodgerblue 0%, darkorange 100%);
}

#speed::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 25px;
  height: 50px;
  border-radius: 5px;
  border-color: white;
  border-width: 2px;
  border-style: solid;
  background: blue;
  cursor: pointer;
  transform: translateY(-12.5px);
}

#volume { display: none; }

@media (max-width: 600px) {
    #site-title {
        left: 4.5rem;
        transform: translateX(0);
        font-size: 1.2rem;
    }
    #color-mode-icon {
        width: 24px;
        height: 24px;
    }
}
#sound-switcher {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0.5rem;
    margin-top: 1.2rem;
    position: relative;
    z-index: 20;
}
#sound-select-btn {
    font-size: 1.2rem;
    padding: 0.7rem 1.1rem;
    border-radius: 1.5rem;
    border: 2px solid dodgerblue;
    background: white;
    color: #222;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 120px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    outline: none;
    position: relative;
    z-index: 22;
}
#sound-select-btn:focus, #sound-select-btn[aria-expanded="true"] {
    background: dodgerblue;
    color: white;
    border-color: darkorange;
}
#sound-select-caret {
    font-size: 1.1rem;
    margin-left: 0.3rem;
}
#sound-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.35);
    z-index: 30;
}
#sound-list {
    position: fixed;
    transform: translate(0, 3rem);
    margin: 0;
    min-width: 220px;
    width: 60%;
    max-width: 340px;
    z-index: 40;
    background: white;
    border: 2px solid dodgerblue;
    border-radius: 1rem;
}
#sound-list.active {
    display: block;
}
#sound-list[hidden] {
    display: none;
}
.sound-option {
    border-radius: inherit;
    font-size: 1.2rem;
    padding: 0.5rem 0.5rem;
    cursor: pointer;
    background: none;
    border: none;
    text-align: left;
    color: black;
    align-items: center;
}
.sound-option.selected, .sound-option:hover {
    background: aliceblue;
    color: dodgerblue;
}

#play-icon.play-animate {
    transform: scale(1.3) rotate(-10deg);
    transition: transform 0.15s;
}

.modal {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.35);
    z-index: 1000;
}
.modal[hidden] {
    display: none;
}
.modal-content {
    background: white;
    border-radius: 1.2rem;
    padding: 2rem 1.5rem 1.2rem 1.5rem;
    max-width: 90%;
    min-width: 240px;
    text-align: center;
}

#about-close {
    margin-top: 1.2rem;
    font-size: 1.1rem;
    padding: 0.5rem 1.2rem;
    border-radius: 0.7rem;
    border: 2px solid dodgerblue;
    background: white;
    color: dodgerblue;
    cursor: pointer;
}
#about-close:focus, #about-close:hover {
    background: dodgerblue;
    color: white;   
}

/* Q&A Section */
#qa-section {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem 1rem;
    background: white;
    border-radius: 0.7rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

#qa-section h2 {
    text-align: center;
    color: #222;
    margin-bottom: 2rem;
    font-size: 1.8rem;
    font-weight: bold;
}

.qa-item {
    margin-bottom: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 0.7rem;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.qa-item:hover {
    border-color: dodgerblue;
}

.qa-item summary {
    padding: 1rem 1.2rem;
    background: #f8f9fa;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.1rem;
    color: #222;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
    list-style: none;
    position: relative;
}

.qa-item summary::-webkit-details-marker {
    display: none;
}

.qa-item summary::after {
    content: "▼";
    position: absolute;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.2s ease;
    color: dodgerblue;
    font-size: 0.9rem;
}

.qa-item[open] summary::after {
    transform: translateY(-50%) rotate(180deg);
}

.qa-item summary:hover {
    background: aliceblue;
    color: dodgerblue;
}

.qa-answer {
    padding: 1.2rem;
    background: white;
    line-height: 1.6;
    color: #444;
}

.qa-answer p {
    margin-bottom: 1rem;
}

.qa-answer p:last-child {
    margin-bottom: 0;
}

.qa-answer ol, .qa-answer ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.qa-answer li {
    margin-bottom: 0.5rem;
}

.qa-answer strong {
    color: #222;
    font-weight: 600;
}

@media (max-width: 600px) {
    #qa-section {
        margin: 1rem;
        padding: 1.5rem 1rem;
    }
    
    .qa-item summary {
        padding: 0.8rem 1rem;
        font-size: 1rem;
    }
    
    .qa-answer {
        padding: 1rem;
    }
}

/* Scenarios Section */
#scenarios-section {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem 1rem;
    background: white;
    border-radius: 0.7rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

#scenarios-section h2 {
    text-align: center;
    color: #222;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    font-weight: bold;
}

#scenarios-section > p {
    text-align: left;
    color: #444;
    margin-bottom: 2rem;
    font-size: 1.1rem;
    line-height: 1.6;
}

@media (max-width: 600px) {
    #scenarios-section {
        margin: 1rem;
        padding: 1.5rem 1rem;
    }
}
