:root {
    --bg-color: #e0f7fa;
    /* Light cyan */
    --header-bg: #ffe0b2;
    /* Light orange */
    --sidebar-bg: #fff;
    --text-color: #333;
    --primary-color: #00bcd4;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    font-family: 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* Landscape Enforcement */
#landscape-warning {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
}

.warning-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 20px;
}

@media (orientation: portrait) {
    #landscape-warning {
        display: flex;
    }
}

/* Layout Grid */
#app-container {
    display: grid;
    grid-template-areas:
        "header sidebar"
        "content sidebar";
    grid-template-columns: 1fr 25vmax;
    /* Sidebar B width: 25vmax */
    grid-template-rows: 10vmax 1fr;
    /* Header A height: 10vmax */
    width: 100vw;
    height: 100vh;
}

/* Section A: Header */
#header-a {
    grid-area: header;
    background-color: var(--header-bg);
    display: flex;
    align-items: center;
    padding-left: 20px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

#header-a h1 {
    font-size: 3vmax;
    color: #e65100;
    margin-left: auto;
    margin-right: 2vmax;
}

/* Section B: Sidebar */
#sidebar-b {
    grid-area: sidebar;
    background-color: var(--sidebar-bg);
    border-left: 2px solid rgba(0, 0, 0, 0.1);
    padding: 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.letter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
}

.letter-btn {
    aspect-ratio: 1;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 2vmax;
    font-weight: bold;
    color: #444;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.letter-btn:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}

.letter-btn:active {
    transform: scale(0.95);
}

.letter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.2);
    transform: translateY(1px);
}

/* Section C: Content */
#content-c {
    grid-area: content;
    position: relative;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#working-area {
    font-size: 15vmax;
    /* Very large display */
    color: #333;
    line-height: 1;
}

#working-area.print {
    font-family: 'Segoe UI', sans-serif;
}

#working-area.cursive {
    font-family: 'Dancing Script', cursive;
    /* Cursive often appears smaller visually, so slight boost if needed, 
       but 15vmax is huge so maybe ok. */
}

/* Home Button */
.home-btn {
    text-decoration: none;
    font-size: 3vmax;
    background: white;
    width: 6vmax;
    height: 6vmax;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    margin-right: 20px;
}

.home-btn:active {
    transform: scale(0.95);
}

/* Font Controls */
.font-controls {
    display: flex;
    gap: 15px;
    flex-shrink: 0;
    /* margin-left: auto; Removed to keep next to Home button */
    margin-right: 20px;
}

.font-btn {
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 5px 15px;
    font-size: 1.5vmax;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    min-width: 4vmax;
    flex-shrink: 0;
}

.font-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.font-btn.print {
    font-family: 'Segoe UI', sans-serif;
}

.font-btn.cursive {
    font-family: 'Dancing Script', cursive;
    font-size: 1.8vmax;
    /* Cursive often needs to be slightly larger */
}

/* Diacritics Toggle */
.toggle-btn {
    font-family: 'Segoe UI', sans-serif;
    background: #f0f0f0;
    color: #999;
    border-color: #ccc;
}

.toggle-btn.active {
    background: #4caf50;
    /* Green for ON */
    color: white;
    border-color: #4caf50;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.separator {
    width: 2px;
    background-color: rgba(0, 0, 0, 0.1);
    margin: 0 10px;
    border-radius: 2px;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 10px;
    margin: 20px 0;
    max-height: 60vh;
    overflow-y: auto;
}

.setting-letter-btn {
    width: 50px;
    height: 50px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f0f0f0;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #999;
}

.setting-letter-btn.enabled {
    background: #e3f2fd;
    /* Light blue */
    color: #1976d2;
    border-color: #2196f3;
    font-weight: bold;
}

.action-btn {
    background: #4caf50;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1.2rem;
    border-radius: 8px;
    cursor: pointer;
}

.letter-btn.disabled {
    opacity: 0.2;
    pointer-events: none;
    filter: grayscale(100%);
}