body {
    font-family: 'Roboto', Arial, sans-serif;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    background: #ffffff;
    color: #000000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    transition: background 0.3s, color 0.3s;
}
body.night-mode {
    background: #181818;
    color: #ffffff;
}
.container {
    background: #ffffff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    width: 95%;
    max-width: 1200px;
    margin: 0 auto;
    border-radius: 8px;
}
.header-strip {
    background-color: #cc181e;
    color: #fff;
    padding: 15px;
    text-align: center;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}
.menu-strip {
    background-color: #f1f1f1;
    padding: 10px;
    text-align: left;
}
.menu-strip ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.menu-strip li {
    display: inline-block;
    margin-right: 20px;
    position: relative;
}
.menu-strip li ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #f1f1f1;
    padding: 10px;
    border: 1px solid #ccc;
    z-index: 1;
}
.menu-strip li:hover ul {
    display: block;
}
.menu-strip li a {
    color: #000;
    text-decoration: none;
    display: block;
    padding: 5px 10px;
    font-weight: bold;
}
.menu-strip li ul li {
    display: block;
    margin-right: 0;
}
.toolbar-strip {
    background-color: #f1f1f1;
    padding: 10px;
    text-align: left;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 5px;
}
.toolbar-strip button {
    background-color: #e0e0e0;
    color: #000;
    border: 1px solid #ccc;
    font-size: 0.9rem;
    padding: 6px 8px;
}
.toolbar-strip button:hover {
    background-color: #cc181e;
    color: #fff;
}
.toolbar-strip select {
    background-color: #e0e0e0;
    color: #000;
    border: 1px solid #ccc;
    font-size: 0.9rem;
    padding: 4px;
}
.editor-area {
    padding: 20px;
    border: 1px solid #ccc;
    font-size: 16px;
    line-height: 1.5;
    overflow-y: auto;
    flex-grow: 1;
    margin: 10px;
    white-space: pre-wrap;
    word-break: break-word;
    border-radius: 0;
    border-left: none;
    border-right: none;
    min-height: 600px;
    background: #ffffff;
    color: #000000;
    outline: none;
}
body.night-mode .container { background: #212121; box-shadow: 0 0 10px rgba(0,0,0,0.5); }
body.night-mode .editor-area { background: #212121; color: #fff; border: 1px solid #444; }
body.night-mode .header-strip { background-color: #cc181e; }
body.night-mode .menu-strip, body.night-mode .toolbar-strip { background-color: #303030; }
body.night-mode .menu-strip li a { color: #fff; }
body.night-mode .menu-strip li ul { background-color: #303030; border: 1px solid #444; }
body.night-mode .toolbar-strip button { background-color: #424242; color: #fff; border: 1px solid #555; }
body.night-mode .toolbar-strip button:hover { background-color: #cc181e; }
body.night-mode .toolbar-strip select { background-color: #424242; color: #fff; border: 1px solid #555; }
.footer-area {
    background-color: #f1f1f1;
    color: #000;
    padding: 10px;
    text-align: center;
    width: 100%;
    margin-top: 1px;
    font-size: 0.9rem;
}
body.night-mode .footer-area { background-color: #303030; color: #fff; }
/* LANDSCAPE: 50% smaller */
@media (orientation: landscape) {
    .header-strip { padding: 1px !important; font-size: 0.8rem !important; }
    .menu-strip, .toolbar-strip { padding: 2px !important; }
    .toolbar-strip button, .toolbar-strip select { font-size: 0.8rem !important; padding: 4px 6px !important; }
    .menu-strip select.mobile-menu-select { font-size: 0.8rem !important; padding: 3px !important; }
}
/* PORTRAIT MOBILE/TABLET: 50% smaller header */
@media (orientation: portrait) and (max-width: 991px) {
    .header-strip { padding: 1px !important; font-size: 0.8rem !important; }
}
/* DESKTOP / HORIZONTAL DEVICES (>=992px) – 10% narrower notepad */
@media (min-width: 992px) {
    .container { max-width: 1080px; }
    .menu-strip { display: flex; justify-content: flex-start; align-items: center; }
    .menu-strip ul#main-menu { display: flex; flex-wrap: nowrap; }
    .menu-strip select.mobile-menu-select { display: none; }
    .menu-strip li { margin-right: 15px; }
    .toolbar-strip { flex-direction: row; }
    .editor-area { min-height: 800px; margin: 10px 0; }
}
@media (max-width: 991px) {
    body { padding: 10px; }
    .container { width: 100%; }
    .menu-strip { padding: 5px; display: flex; flex-wrap: nowrap; justify-content: space-between; align-items: center; gap: 5px; }
    .menu-strip ul#main-menu { display: none; }
    .menu-strip select.mobile-menu-select {
        display: inline-block; flex: 1; min-width: 60px; max-width: 70px; padding: 5px 20px 5px 5px; font-size: 14px; font-weight: bold;
        color: #000; background-color: #e0e0e0; border: 1px solid #ccc; border-radius: 4px; cursor: pointer; text-align: center;
        appearance: none; -webkit-appearance: none; -moz-appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='transparent'%3E%3Cpath d='M7 10l5 5 5-5' /%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 5px center;
        background-size: 12px;
        text-overflow: '';
        text-indent: 1px;
    }
    .menu-strip select.mobile-menu-select::-ms-expand {
        display: none;
    }
    body.night-mode .menu-strip select.mobile-menu-select { 
        color: #fff; background-color: #424242; border: 1px solid #555; 
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='transparent'%3E%3Cpath d='M7 10l5 5 5-5' /%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 5px center;
        background-size: 12px;
        padding: 5px 20px 5px 5px;
        text-overflow: '';
        text-indent: 1px;
    }
    .toolbar-strip { padding: 5px; display: flex; flex-wrap: nowrap; overflow-x: auto; }
    .toolbar-strip button, .toolbar-strip select { width: auto; margin-bottom: 0; margin-right: 5px; }
    .editor-area { margin: 5px; min-height: 900px; overflow-y: auto; }
}
@media print {
    body { background: white !important; padding: 0 !important; display: block !important; }
    .container { box-shadow: none !important; width: 100% !important; max-width: none !important; margin: 0 !important; display: block !important; }
    .header-strip, .menu-strip, .toolbar-strip, .footer-area { display: none !important; }
    .editor-area { border: none !important; margin: 0 !important; padding: 0 !important; min-height: auto !important; font-size: 12pt; line-height: 1.3; }
}
#calculator-modal .modal-body { padding: 20px; text-align: center; }
#calculator-modal input[type="text"] { width: 80%; margin-bottom: 10px; padding: 10px; font-size: 1.2em; border: 1px solid #ccc; }
#calculator-modal .buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; width: 80%; margin: 0 auto; }
#calculator-modal button { padding: 10px; font-size: 1.1em; border: 1px solid #ccc; cursor: pointer; }
#calculator-modal button.operator { background-color: #e0e0e0; color: #000; }
#calculator-modal button.equal { background-color: #cc181e; color: white; }
body.night-mode #calculator-modal button.operator { background-color: #424242; color: #fff; }