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

body {
    min-height: 100vh;
    background-image: url('bg.png');
    background-size: 100% 100%;
    position: relative;
    -webkit-user-select: none;
    user-select: none;
}

.date {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(18px, 1.8vw, 32px);
    color: #333;
    z-index: 10;
}

.content {
    position: absolute;
    top: 33%;
    left: -3%;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
    z-index: 10;
    padding: 0 10%;
}

.lunch-menu, .dinner-menu {
    width: 50%;
}

.menu-list {
    list-style: none;
}

.menu-item {
    font-size: clamp(24px, 2.5vw, 45px);
    font-weight: bolder;
    color: #333;
    padding: 8px 0;
    line-height: 1;
    text-align: center;
}

.bottom-buttons {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    gap: 12px;
    z-index: 1000;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: clamp(12px, 1.2vw, 16px);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-refresh { background: #2196F3; color: white; }
.btn-refresh:hover { background: #1976D2; }
.btn-change { background: #FF9800; color: white; }
.btn-change:hover { background: #F57C00; }

.connection-status {
    position: fixed;
    bottom: 3%;
    right: 11.2%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 5px;
    border-radius: 2px;
    font-size: clamp(12px, 1.2vw, 16px);
    z-index: 1000;
    transition: all 0.3s;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.connection-status.connected { background: rgba(46, 125, 50, 0.9); color: white; }
.connection-status.connected .status-dot { background: #4CAF50; }
.connection-status.disconnected { background: rgba(198, 40, 40, 0.9); color: white; }
.connection-status.disconnected .status-dot { background: #f44336; }
.connection-status.connecting { background: rgba(255, 152, 0, 0.9); color: white; }
.connection-status.connecting .status-dot { background: #FF9800; }

.context-menu-overlay {
    position: fixed;
    bottom: 10%; right: 10%;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0);
    display: none;
    justify-content: flex-end;
    align-items: flex-end;
    z-index: 3000;
    pointer-events: none;
}

.context-menu-overlay.show {
    display: flex;
    /* background: rgba(0, 0, 0, 0.3); */
    pointer-events: auto;
}

.context-menu {
    background: white;
    border-radius: 12px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    width: 180px;
    margin: 20px;
    overflow: hidden;
}

.context-menu-header {
    padding: 16px;
    background: #f5f5f5;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: center;
}

#qrcode {
    width: clamp(100px, 15vw, 200px);
    height: clamp(100px, 15vw, 200px);
    display: flex;
    justify-content: center;
    align-items: center;
}

#qrcode img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.context-menu-body {
    padding: 16px;
    display: flex;
    /* flex-direction: column; */
    gap: 12px;
}

.context-btn {
    width: 100%;
    padding: 4px;
    border: none;
    border-radius: 2px;
    font-size: clamp(14px, 1.4vw, 18px);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.context-btn:nth-child(1) {
    background: #2196F3;
    color: white;
}

.context-btn:nth-child(1):hover {
    background: #1976D2;
}

.context-btn:nth-child(2) {
    background: #FF9800;
    color: white;
}

.context-btn:nth-child(2):hover {
    background: #F57C00;
}

.modal-overlay {
    position: fixed;
    top: 0; right: 200px;
    width: 100%; height: 100%;
    /* background: rgba(0, 0, 0, 0.5); */
    display: none;
    justify-content: flex-end;
    align-items: flex-end;
    z-index: 2000;
}

.modal-overlay.show { display: flex; }

.modal {
    background: white;
    border-radius: 12px 12px 0 0;
    padding: 30px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.modal-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
}

.input-group {
    margin-bottom: 16px;
}

.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.btn-clear {
    background: #f44336;
    color: white;
    padding: 6px 12px;
    font-size: clamp(10px, 1vw, 14px);
    border-radius: 4px;
    cursor: pointer;
}

.btn-clear:hover {
    background: #d32f2f;
}

.input-group label {
    display: block;
    font-size: clamp(12px, 1.2vw, 16px);
    font-weight: 500;
    color: #333;
    margin-bottom: 0;
}

.input-group textarea {
    width: 100%;
    height: 180px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: clamp(12px, 1.2vw, 16px);
    font-family: monospace;
    resize: vertical;
}

.input-group textarea:focus {
    outline: none;
    border-color: #4CAF50;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn-send { background: #4CAF50; color: white; }
.btn-send:hover { background: #45a049; }
.btn-cancel { background: #999; color: white; }
.btn-cancel:hover { background: #888; }

@media (max-width: 768px) {
    .content { gap: 40px; flex-direction: column; align-items: center; }
    .menu-item { font-size: 20px; }
    .modal {
        width: 100%;
        height: 100%;
        max-height: 100%;
        max-width: 100%;
        border-radius: 0;
        padding: 20px;
    }
    .context-menu {
        width: 100%;
        margin: 0;
        border-radius: 0;
    }
    .input-group textarea {height: 200px;}
    .btn-clear {
        padding: 4px 8px;
        font-size: 11px;
    }
    .modal-overlay{
        right: 0;
    }
}
.dining-qrcode-section {
    position: fixed;
    bottom: 8%;
    right: 3%;
    background: white;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    z-index: 1500;
    width: clamp(160px, 20vw, 240px);
}

.dining-qrcode-title {
    font-size: clamp(12px, 1.2vw, 16px);
    font-weight: 600;
    color: #333;
    text-align: center;
    margin-bottom: 8px;
}

.dining-meal-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.dining-meal-tab {
    flex: 1;
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    background: #e8e8e8;
    color: #666;
    font-size: clamp(10px, 1vw, 13px);
    cursor: pointer;
    transition: all 0.2s;
}

.dining-meal-tab.active {
    background: #2196F3;
    color: white;
    font-weight: 600;
}

.dining-qrcode-img {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    aspect-ratio: 1;
    margin-bottom: 8px;
}

.dining-qrcode-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.dining-qrcode-info {
    font-size: clamp(10px, 1vw, 13px);
    color: #999;
    text-align: center;
    margin-bottom: 8px;
}

.dining-status-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    justify-content: center;
}

.dining-status-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: clamp(9px, 0.9vw, 12px);
    color: #666;
}

.dining-status-legend .legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot-green { background: #4CAF50; }
.dot-red { background: #f44336; }
.dot-gray { background: #e8e8e8; }
.dot-orange { background: #FF9800; }

.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 16px 32px;
    border-radius: 8px;
    font-size: clamp(14px, 1.4vw, 18px);
    z-index: 4000;
    display: none;
    animation: toastFade 0.3s ease;
}

.toast.show {
    display: block;
}

@keyframes toastFade {
    from { opacity: 0; transform: translate(-50%, -40%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}
.bottom-tabs {
    position: fixed;
    bottom: 30px;
    right: 300px;
    display: flex;
    gap: 12px;
    z-index: 5000;
}

.bottom-tab {
    padding: 2px 5px;
    border: none;
    border-radius: 8px;
    background: #e8e8e8;
    color: #666;
    font-size: clamp(12px, 1.2vw, 16px);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.bottom-tab.active {
    background: #2196F3;
    color: white;
    font-weight: 600;
}

.roster-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    background: #f5f5f5;
    display: flex;
    flex-direction: column;
    padding: 12px;
}

.roster-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: white;
    border-radius: 8px;
    margin-bottom: 12px;
}

.roster-meal-label {
    font-size: clamp(18px, 2vw, 28px);
    font-weight: 700;
    color: #333;
}

.roster-date-label {
    font-size: clamp(12px, 1.2vw, 16px);
    color: #999;
}

.roster-meal-switch {
    display: flex;
    gap: 8px;
}

.meal-switch-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    background: #e8e8e8;
    color: #666;
    font-size: clamp(14px, 1.4vw, 20px);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.meal-switch-btn.active {
    background: #2196F3;
    color: white;
    font-weight: 600;
}

.roster-content {
    flex: 1;
    min-height: 0;
    display: flex;
    gap: 12px;
    overflow: hidden;
    justify-content: center;
}

.roster-card {
    flex: 1;
    background: white;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.roster-card-red { border-top: 4px solid #f44336; }
.roster-card-green { border-top: 4px solid #4CAF50; }

.roster-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #eee;
}

.roster-card-title {
    font-size: clamp(14px, 1.4vw, 20px);
    font-weight: 600;
    color: #333;
}

.roster-card-red .roster-card-title { color: #f44336; }
.roster-card-green .roster-card-title { color: #4CAF50; }

.roster-card-count {
    font-size: clamp(18px, 2vw, 28px);
    font-weight: 700;
}

.roster-card-red .roster-card-count { color: #f44336; }
.roster-card-green .roster-card-count { color: #4CAF50; }

.roster-card-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    align-content: flex-start;
}

.roster-person {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 4px;
    background: #f0f0f0;
    font-size: clamp(11px, 1vw, 14px);
}

.roster-person-name {
    font-weight: 500;
    color: #333;
}

.roster-person-time {
    font-size: clamp(9px, 0.8vw, 11px);
    color: #999;
    margin-left: 4px;
}

.roster-person.dined-ordered .roster-person-name { color: #4CAF50; }
.roster-person.dined-not-ordered .roster-person-name { color: #FF9800; }
.roster-person.dined-not-ordered {
    background: #fff3e0;
    border-radius: 4px;
    padding: 3px 8px;
}

.roster-divider {
    height: 1px;
    background: #FF9800;
    margin: 8px 0;
    opacity: 0.3;
}

.roster-qrcode {
    width: clamp(180px, 22vw, 280px);
    background: white;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.roster-qrcode-title {
    font-size: clamp(14px, 1.4vw, 18px);
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.roster-qrcode-img {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
}

.roster-qrcode-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.roster-qrcode-info {
    font-size: clamp(11px, 1vw, 14px);
    color: #999;
    text-align: center;
}

.roster-empty {
    text-align: center;
    color: #ccc;
    padding: 20px;
    font-size: clamp(13px, 1.3vw, 16px);
}

@media (max-width: 768px) {
    .roster-content { flex-direction: column; }
    .roster-qrcode { width: 100%; flex-direction: row; justify-content: space-around; }
    .roster-qrcode-img { width: 120px; height: 120px; }
}
