* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Sarabun', 'Segoe UI', Tahoma, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

/* Index page */
.index-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    color: #fff;
}

.index-main {
    text-align: center;
    padding: 2rem;
}

.index-main h1 {
    font-size: 2rem;
    margin-bottom: 2rem;
}

.index-buttons {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 320px;
    margin: 0 auto;
}

.index-btn {
    display: block;
    padding: 1.5rem 2rem;
    font-size: 1.25rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.index-btn:active {
    transform: scale(0.98);
}

.controller-btn {
    background: #2563eb;
    color: #fff;
    border: none;
}

.controller-btn:hover {
    background: #1d4ed8;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.speaker-btn {
    background: #059669;
    color: #fff;
    border: none;
}

.speaker-btn:hover {
    background: #047857;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.4);
}

/* Controller page */
.controller-page {
    min-height: 100vh;
    background: #f3f4f6;
    padding: 1rem;
}

.controller-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0 0.5rem;
}

.controller-header h1 {
    font-size: 1.5rem;
    color: #1f2937;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-text {
    background: none;
    border: none;
    color: #2563eb;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0.5rem;
    transition: opacity 0.2s;
}

.btn-text:hover {
    opacity: 0.7;
    text-decoration: underline;
}

.btn-danger-text {
    color: #dc2626 !important;
}

.btn-danger-text:hover {
    color: #991b1b !important;
}

.section-header-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header-with-action h2 {
    margin: 0;
}

.btn-qr-code {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-qr-code:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-qr-code:active {
    transform: translateY(0);
}

/* QR Code Modal */
.qr-modal-content {
    max-width: 500px;
}

.qr-modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
}

.qr-instruction {
    text-align: center;
    color: #6b7280;
    font-size: 1rem;
    margin: 0;
}

.qr-code-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 220px;
    margin: 0 auto;
}

.qr-code-container img {
    display: block;
    max-width: 100%;
    height: auto;
}

.qr-pin-text {
    text-align: center;
    color: #374151;
    font-size: 1rem;
    margin: 0;
}

.qr-pin-text strong {
    font-size: 1.25rem;
    color: #1f2937;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.2rem;
}

.qr-url-display {
    display: flex;
    gap: 0.75rem;
    width: 100%;
}

.qr-url-input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    background: #f9fafb;
    color: #374151;
    text-align: center;
}

.qr-url-input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-success {
    background: #22c55e !important;
    color: white !important;
}

.back-link {
    color: #2563eb;
    text-decoration: none;
    font-size: 1rem;
}

.back-link:hover {
    text-decoration: underline;
}

.controller-main {
    max-width: 920px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    align-items: start;
}

.preview-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (max-width: 768px) {
    .controller-main {
        grid-template-columns: 1fr;
    }
}

.controller-section {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.controller-section h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #374151;
}

.send-form label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: #4b5563;
}

.send-form input[type="text"],
.send-form textarea,
.send-form select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    margin-top: 0.25rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}

.send-form textarea {
    min-height: 80px;
    resize: vertical;
}

.controller-form-column {
    min-width: 0;
}

.form-row {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.color-blink-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.color-blink-row .color-options {
    margin-bottom: 0;
}

.color-blink-row .blink-toggle-row {
    margin-bottom: 0;
}

.color-options {
    margin-bottom: 1rem;
}

.color-label {
    display: block;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 0.5rem;
}

.color-swatch-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.color-swatch-wrap {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    padding: 2px;
}

.color-swatch-wrap input {
    position: absolute;
    opacity: 0;
}

.color-swatch {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.color-swatch-white {
    border-color: #d1d5db;
}

.color-swatch-wrap input:checked + .color-swatch {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.5);
}

.color-name {
    font-size: 0.85rem;
    color: #4b5563;
}

.blink-toggle-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.blink-label {
    font-weight: 500;
    color: #4b5563;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #d1d5db;
    border-radius: 26px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: #2563eb;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

.options-tagging {
    margin-bottom: 1rem;
}

.options-tagging label {
    display: block;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 0.5rem;
}

.options-input-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0.4rem 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    cursor: text;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.options-input-container:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.options-tags-inline {
    display: contents;
}

.options-input-inline {
    flex: 1;
    min-width: 120px;
    border: none;
    outline: none;
    padding: 0.3rem 0;
    font-size: 0.95rem;
    background: transparent;
}

.options-input-inline::placeholder {
    color: #9ca3af;
}

.option-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
    background: #e0e7ff;
    color: #3730a3;
    border-radius: 6px;
}

.option-tag-remove {
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    color: #6366f1;
    font-size: 1.1rem;
    line-height: 1;
}

.option-tag-remove:hover {
    color: #4338ca;
}

.options-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.btn-preset {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #7dd3fc;
    border-radius: 20px;
    color: #0369a1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-preset:hover {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border-color: #38bdf8;
    transform: translateY(-1px);
}

.btn-preset:active {
    transform: translateY(0);
}

.btn-preset.active {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    border-color: #0284c7;
    color: white;
}

/* Removed old .options-input - now using .options-input-inline */

.send-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    align-items: stretch;
}

.send-actions .btn {
    flex: 1;
    min-width: 0;
    height: 44px;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.preview-panel {
    background: #000;
    border-radius: 12px;
    padding: 1rem;
    position: sticky;
    top: 1rem;
}

.preview-countdown {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.35rem 0.6rem;
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 6px;
    background: rgba(0,0,0,0.3);
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    width: 5rem;
    box-sizing: border-box;
    text-align: center;
}

.preview-countdown[aria-hidden="false"] {
    display: flex;
}

.preview-countdown-label {
    font-size: 0.55rem;
    color: rgba(255,255,255,0.7);
    text-align: center;
    display: block;
}

.preview-countdown-time {
    font-size: 0.85rem;
    text-align: center;
    display: block;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #fff;
}

.preview-countdown.is-expired .preview-countdown-time {
    color: #f87171;
}

.status-section {
    background: #fff;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.status-section h2 {
    font-size: 1rem;
    margin: 0 0 0.75rem;
    color: #374151;
}

.status-content {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.preview-panel h2 {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.6);
    margin-bottom: 0.75rem;
}

.speaker-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.speaker-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.speaker-status-online .speaker-status-dot {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

.speaker-status-offline .speaker-status-dot {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

.speaker-status-online .speaker-status-label {
    color: #22c55e;
}

.speaker-status-offline .speaker-status-label {
    color: #ef4444;
}

.preview-content {
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.preview-message {
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    color: #fff;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    width: 100%;
}

.preview-message.blink {
    animation: blink 1s ease-in-out infinite;
}

.preview-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
}

.preview-btn-hint {
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.8);
    border-radius: 6px;
}

.response-panel {
    background: #fff;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.response-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.response-panel h2 {
    font-size: 1rem;
    margin: 0;
    color: #374151;
}

.btn-text {
    background: none;
    border: none;
    color: #2563eb;
    font-size: 0.9rem;
    cursor: pointer;
}

.btn-text:hover {
    text-decoration: underline;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.modal.is-open,
.modal[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
    font-size: 1.1rem;
    margin: 0;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #1f2937;
}

.modal-close {
    width: 32px;
    height: 32px;
    font-size: 1.5rem;
    line-height: 1;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
}

.modal-close:hover {
    color: #1f2937;
}

.modal-body {
    padding: 1rem 1.25rem;
    max-height: 50vh;
    overflow-y: auto;
}

.modal-paging {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.page-info {
    font-size: 0.9rem;
    color: #6b7280;
}

.btn-page {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
}

.btn-page:hover:not(:disabled) {
    background: #f3f4f6;
}

.btn-page:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Emergency overlay */
.emergency-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.emergency-overlay[aria-hidden="false"],
.emergency-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.emergency-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
}

.emergency-overlay-content {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    border: 4px solid #2563eb;
}

.emergency-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.emergency-overlay-content h2 {
    font-size: 1.5rem;
    color: #2563eb;
    margin-bottom: 0.5rem;
}

.emergency-overlay-content p {
    color: #4b5563;
    margin-bottom: 1.5rem;
}

.emergency-overlay-actions {
    margin-bottom: 0;
}

.emergency-overlay-done {
    margin-top: 1rem;
}

.emergency-done-text {
    color: #059669;
    font-weight: 600;
    margin-bottom: 1rem;
}

.btn-emergency {
    background: #2563eb;
    color: #fff;
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-emergency:hover {
    background: #1d4ed8;
}

.response-box {
    min-height: 80px;
    transition: background-color 0.3s ease;
}

.response-box.new-response {
    animation: greenBlink 5s ease-in-out;
}

@keyframes greenBlink {
    0%, 100% {
        background-color: transparent;
    }
    5%, 15%, 25%, 35%, 45% {
        background-color: #d1fae5;
    }
    10%, 20%, 30%, 40%, 50% {
        background-color: #a7f3d0;
    }
    55% {
        background-color: #d1fae5;
    }
    60% {
        background-color: transparent;
    }
}

.response-empty {
    color: #9ca3af;
    font-size: 0.9rem;
}

.response-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.response-item:last-child {
    border-bottom: none;
}

.response-message {
    font-size: 0.9rem;
    color: #4b5563;
    margin-bottom: 0.25rem;
}

.response-answer {
    font-size: 0.95rem;
    color: #047857;
}

.response-time {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
    margin-top: 1rem;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.btn-secondary:hover {
    background: #d1d5db;
}

.history-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.history-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    background: #e0e7ff;
    color: #3730a3;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.history-btn:hover {
    background: #c7d2fe;
}

/* Countdown controls */
.countdown-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.countdown-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.countdown-custom-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.countdown-custom-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.countdown-input {
    width: 4rem;
    padding: 0.5rem;
    font-size: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    text-align: center;
}

.countdown-input:focus {
    outline: none;
    border-color: #2563eb;
}

.countdown-custom-unit {
    font-size: 0.95rem;
    color: #6b7280;
}

.btn-countdown {
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-countdown:hover {
    background: #1d4ed8;
}

.btn-countdown:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-countdown:disabled:hover {
    background: #2563eb;
}

.countdown-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f3f4f6;
}

.countdown-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.countdown-actions .btn {
    margin: 0;
}

.btn-countdown-start,
.btn-countdown-stop {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.btn-countdown-stop {
    background: #2563eb;
    color: #fff;
}

.btn-countdown-stop:hover {
    background: #1d4ed8;
}

.countdown-status {
    font-size: 0.9rem;
    color: #6b7280;
    margin-top: 0.75rem;
}

/* Speaker page */
.speaker-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    z-index: 10;
}

.speaker-top-left {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 100;
}

.speaker-top-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
}

.speaker-top-right .emergency-btn {
    width: 12rem;
    box-sizing: border-box;
}

.logout-btn {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.2);
}

.clock-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 8px;
    background: rgba(0,0,0,0.3);
    width: 12rem;
    box-sizing: border-box;
}

.clock-label {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.7);
}

.speaker-clock {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #fff;
}

.speaker-page {
    min-height: 100vh;
    background: #000;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.speaker-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 5rem 2rem 2rem;
    min-height: 0;
}

.countdown-area {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 8px;
    background: rgba(0,0,0,0.3);
    width: 12rem;
    box-sizing: border-box;
}

.countdown-area[aria-hidden="false"] {
    display: flex;
}

.countdown-label {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.7);
}

.countdown-time {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
    color: #fff;
}

.countdown-area.is-expired .countdown-time {
    color: #f87171;
}

.speaker-bottom-right {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
}

.speaker-bottom-right .emergency-btn {
    width: 12rem;
    min-height: 4rem;
    box-sizing: border-box;
}

.emergency-btn {
    padding: 1.25rem 2rem;
    font-size: 1.25rem;
    min-height: 3.5rem;
    font-weight: 600;
    background: #2563eb;
    color: #fff;
    border: 2px solid #93c5fd;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.emergency-btn:hover:not(:disabled) {
    background: #1d4ed8;
}

.emergency-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.emergency-btn.is-pending,
.emergency-btn:disabled {
    background: #6b7280;
    border-color: #9ca3af;
    cursor: not-allowed;
}

.emergency-btn.is-acknowledged {
    background: #059669;
    border-color: #34d399;
}

.emergency-btn.is-acknowledged:hover {
    background: #047857;
}

.emergency-ack {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 1.5rem 2rem;
    font-size: 1.5rem;
    font-weight: 600;
    background: #059669;
    color: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.emergency-ack.is-visible {
    opacity: 1;
    visibility: visible;
}

.message-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 0;
    width: 100%;
    max-width: 100%;
}

.message-display {
    font-size: clamp(2.5rem, 8vw, 6rem);
    font-weight: 700;
    text-align: center;
    line-height: 1.3;
    margin-bottom: 2rem;
    max-width: 90%;
    width: 100%;
}

.message-display.blink {
    animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.buttons-area {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.speaker-btn-ack,
.speaker-btn-option {
    padding: 1rem 2rem;
    font-size: 1.25rem;
    font-weight: 600;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.speaker-btn-ack:hover,
.speaker-btn-option:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.8);
}

.fullscreen-btn {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.fullscreen-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* Sent confirmation */
.sent-confirmation {
    font-size: 1.5rem;
    color: #22c55e;
}

/* Settings Modal */
.settings-section {
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    font-size: 1.125rem;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.settings-description {
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.pin-change-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pin-change-input {
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.pin-change-input:focus {
    outline: none;
    border-color: #2563eb;
}

.pin-change-form .btn {
    margin-top: 0.5rem;
}
