.cno-wrapper {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #4a1942 0%, #1a1a2e 100%);
    min-height: calc(100vh - 70px - 60px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    margin: -20px;
}

.cno-container {
    text-align: center;
    max-width: 720px;
    width: 100%;
}

.cno-room-container {
    max-width: 560px;
}

.cno-wrapper h1,
.cno-admin-wrapper h1 {
    color: white;
    font-size: 2.2em;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.cno-room-title {
    font-size: 1.6em;
}

.cno-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.05em;
    margin-bottom: 20px;
}

.cno-landing-panel,
.cno-room-info,
.cno-setup-panel,
.cno-lobby-panel {
    background: rgba(255, 255, 255, 0.96);
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    margin-bottom: 14px;
}

.cno-primary-btn,
.cno-secondary-btn {
    padding: 12px 20px;
    font-size: 1em;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cno-primary-btn {
    background: #8e44ad;
    color: white;
}

.cno-primary-btn:hover:not(:disabled) {
    background: #732d91;
    transform: translateY(-1px);
}

.cno-secondary-btn {
    background: white;
    color: #8e44ad;
    border: 2px solid #8e44ad;
}

.cno-secondary-btn:hover:not(:disabled) {
    background: #f8eefb;
}

.cno-primary-btn:disabled,
.cno-secondary-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.cno-link-btn {
    display: inline-block;
    text-decoration: none;
    margin-top: 10px;
}

.cno-divider {
    margin: 16px 0;
    color: #888;
    font-size: 0.9em;
    text-transform: uppercase;
}

.cno-join-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.cno-join-form label,
.cno-setup-field label {
    font-weight: 600;
    color: #333;
    font-size: 0.9em;
}

.cno-join-form input,
.cno-setup-field input,
.cno-setup-field select,
.cno-share-input-row input {
    padding: 10px;
    font-size: 1em;
    border: 2px solid #ddd;
    border-radius: 8px;
}

.cno-join-form input {
    text-align: center;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.cno-error {
    color: #ffd43b;
    font-weight: 600;
    margin-top: 12px;
}

.cno-room-info {
    text-align: left;
}

.cno-room-info-summary {
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    user-select: none;
}

.cno-room-info-summary::-webkit-details-marker {
    display: none;
}

.cno-room-info-summary::marker {
    content: "";
}

.cno-room-info-hint {
    font-size: 0.8em;
    font-weight: 500;
    opacity: 0.75;
}

.cno-room-info:not([open]) .cno-room-info-hint {
    display: none;
}

.cno-room-info-summary::after {
    content: "▾";
    font-size: 0.9em;
    opacity: 0.75;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.cno-room-info:not([open]) .cno-room-info-summary::after {
    transform: rotate(-90deg);
}

.cno-room-info-body {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.cno-share-row label {
    display: block;
    font-size: 0.9em;
    margin-bottom: 6px;
}

.cno-share-input-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cno-share-input-row input {
    flex: 1;
    min-width: 160px;
}

.cno-copy-btn {
    padding: 8px 14px;
}

.cno-role-badge {
    margin-top: 10px;
    display: inline-block;
    background: #8e44ad;
    color: white;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85em;
    font-weight: 600;
}

.cno-status-message {
    color: rgba(255, 255, 255, 0.95);
    margin: 12px 0;
    min-height: 1.4em;
    font-size: 0.95em;
}

.cno-toast {
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.cno-setup-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    text-align: left;
}

.cno-checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0;
    font-size: 0.95em;
    text-align: left;
}

.cno-lobby-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cno-play-bar-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cno-setup-panel[hidden],
.cno-lobby-panel[hidden],
.cno-join-panel[hidden],
.cno-grid-wrap[hidden],
.cno-play-bar[hidden],
.cno-share-row[hidden],
.cno-role-badge[hidden],
.cno-status-message[hidden],
.cno-toast[hidden],
.cno-start-btn[hidden],
.cno-redeal-btn[hidden],
.cno-done-btn[hidden],
.cno-reveal-key-btn[hidden],
.cno-rematch-btn[hidden],
.cno-guess-log[hidden],
.cno-turn-announce[hidden] {
    display: none !important;
}

.cno-grid-wrap {
    margin-bottom: 80px;
}

.cno-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.cno-tile {
    position: relative;
    aspect-ratio: 1.2;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: clamp(0.55rem, 2.8vw, 0.78rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 4px;
    cursor: default;
    color: #1a1a1a;
    line-height: 1.15;
    word-break: break-word;
    hyphens: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.cno-tile-word {
    display: block;
    width: 100%;
    pointer-events: none;
    user-select: none;
}

.cno-tile-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.52rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    padding: 1px 4px;
    border-radius: 4px;
    line-height: 1.2;
    pointer-events: none;
    text-transform: uppercase;
    z-index: 2;
}

.cno-tile-badge-confirm {
    background: #8e44ad;
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(142, 68, 173, 0.35);
    animation: cnoBadgePulse 0.9s infinite alternate;
}

@keyframes cnoBadgePulse {
    from { opacity: 0.85; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1.05); }
}

.cno-tile-badge-guessed {
    background: rgba(0, 0, 0, 0.45);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.cno-tile-badge-unguessed {
    background: rgba(255, 255, 255, 0.95);
    color: #1a1a1a;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.cno-tile-badge-assassin {
    background: #111111;
    color: #ff5252;
    border: 1px solid #ff5252;
}

.cno-tile-selected {
    box-shadow: 0 0 0 3px #8e44ad, 0 4px 14px rgba(142, 68, 173, 0.5) !important;
    transform: translateY(-2px) scale(1.03) !important;
    border-color: #8e44ad !important;
    background-color: #f5eefb !important;
    color: #2c003e !important;
    z-index: 5;
}

.cno-tile-hidden {
    background: #eceff4;
    color: #1a1a1a;
}

.cno-tile-red {
    background: #c0392b;
    color: white;
}

.cno-tile-blue {
    background: #2980b9;
    color: white;
}

.cno-tile-neutral {
    background: #d4b896;
    color: #1a1a1a;
}

.cno-tile-assassin {
    background: #2c2c2c;
    color: white;
}

.cno-tile-revealed {
    opacity: 0.92;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 4px,
        rgba(255, 255, 255, 0.18) 4px,
        rgba(255, 255, 255, 0.18) 8px
    );
}

.cno-tile-hidden.cno-tile-revealed,
.cno-guesser-phone .cno-tile-revealed {
    cursor: default;
}

.cno-tile-hidden:not(.cno-tile-revealed) {
    cursor: pointer;
}

.cno-clue-giver-phone .cno-tile-red:not(.cno-tile-guessed-dim) {
    background: #e74c3c;
}

.cno-clue-giver-phone .cno-tile-blue:not(.cno-tile-guessed-dim) {
    background: #3d9ee0;
}

.cno-clue-giver-phone .cno-tile-neutral:not(.cno-tile-guessed-dim) {
    background: #ecd4ad;
}

.cno-clue-giver-phone .cno-tile-assassin:not(.cno-tile-guessed-dim) {
    background: #111111;
}

.cno-tile-guessed-dim {
    cursor: default;
}

.cno-tile-guessed-dim.cno-tile-red {
    background: #8f423a;
    color: rgba(255, 255, 255, 0.55);
}

.cno-tile-guessed-dim.cno-tile-blue {
    background: #3d6f94;
    color: rgba(255, 255, 255, 0.55);
}

.cno-tile-guessed-dim.cno-tile-neutral {
    background: #8f7a5e;
    color: rgba(255, 255, 255, 0.5);
}

.cno-tile-guessed-dim.cno-tile-assassin {
    background: #3a3a3a;
    color: rgba(255, 255, 255, 0.45);
}

@keyframes cnoCardFlip {
    0% {
        transform: perspective(600px) rotateY(0deg) scale(1);
    }
    50% {
        transform: perspective(600px) rotateY(90deg) scale(1.08);
    }
    100% {
        transform: perspective(600px) rotateY(0deg) scale(1);
    }
}

.cno-tile-flipping {
    animation: cnoCardFlip 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cnoJustGuessedPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.85);
        transform: scale(1);
    }
    40% {
        box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.35);
        transform: scale(1.06);
        z-index: 6;
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
        transform: scale(1);
    }
}

.cno-tile-just-guessed {
    animation: cnoCardFlip 0.38s cubic-bezier(0.4, 0, 0.2, 1),
        cnoJustGuessedPulse 1.1s ease 0.32s;
    z-index: 6;
}

.cno-boot-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.55rem;
    background: rgba(0, 0, 0, 0.55);
    color: white;
    padding: 2px 4px;
    border-radius: 4px;
    cursor: pointer;
}

.cno-play-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 46, 0.96);
    color: white;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
    z-index: 20;
    transition: background 0.35s ease, border-color 0.35s ease;
}

.cno-turn-red .cno-play-bar {
    border-top: 6px solid #e74c3c;
    background: #6b1d18;
}

.cno-turn-blue .cno-play-bar {
    border-top: 6px solid #5dade2;
    background: #163a5f;
}

@keyframes cnoPlayBarFlash {
    0%, 100% {
        filter: brightness(1);
    }
    18% {
        filter: brightness(1.55);
    }
    36% {
        filter: brightness(1);
    }
    54% {
        filter: brightness(1.35);
    }
}

.cno-play-bar-flash {
    animation: cnoPlayBarFlash 1.15s ease;
}

.cno-turn-banner {
    font-size: 1.08rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.cno-guess-log {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 0 0 10px;
    text-align: left;
}

.cno-guess-log-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.cno-guess-log-label {
    flex-shrink: 0;
    width: 5.6em;
    padding-top: 3px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.72;
}

.cno-guess-log-words {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 1.4em;
}

.cno-guess-log-empty {
    font-size: 0.82rem;
    font-weight: 500;
    opacity: 0.55;
}

.cno-guess-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    line-height: 1.35;
}

.cno-guess-chip-red {
    background: #c0392b;
    color: #ffffff;
}

.cno-guess-chip-blue {
    background: #2980b9;
    color: #ffffff;
}

.cno-guess-chip-neutral {
    background: #d4b896;
    color: #1a1a1a;
}

.cno-guess-chip-assassin {
    background: #111111;
    color: #ffffff;
}

@keyframes cnoChipFresh {
    0% {
        transform: scale(0.7);
        opacity: 0;
    }
    40% {
        transform: scale(1.12);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.cno-guess-chip-fresh {
    animation: cnoChipFresh 0.45s ease;
}

.cno-turn-announce {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.42);
}

.cno-turn-announce-card {
    min-width: min(78%, 320px);
    padding: 26px 32px;
    border-radius: 16px;
    text-align: center;
    color: #ffffff;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.cno-turn-announce-red .cno-turn-announce-card {
    background: #c0392b;
}

.cno-turn-announce-blue .cno-turn-announce-card {
    background: #2980b9;
}

.cno-turn-announce-neutral .cno-turn-announce-card {
    background: #d4b896;
    color: #1a1a1a;
}

.cno-turn-announce-assassin .cno-turn-announce-card {
    background: #111111;
}

.cno-turn-announce-kicker {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    opacity: 0.88;
}

.cno-turn-announce-name {
    margin-top: 6px;
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.15;
}

@keyframes cnoTurnPop {
    0% {
        transform: scale(0.72);
        opacity: 0;
    }
    12% {
        transform: scale(1.06);
        opacity: 1;
    }
    78% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0.98);
        opacity: 0;
    }
}

.cno-turn-announce-pop {
    animation: cnoTurnPop 2.4s ease forwards;
}

.cno-done-btn {
    width: 100%;
}

.cno-compact-play .cno-room-title {
    font-size: 1.1em;
    margin-bottom: 4px;
}

.cno-compact-play .cno-room-info {
    display: none;
}

.cno-compact-play .cno-grid-wrap {
    margin-bottom: 108px;
}

.cno-compact-play.cno-has-guess-log .cno-grid-wrap {
    margin-bottom: 176px;
}

.cno-lobby-swap-only {
    padding: 12px 18px;
}

.cno-lobby-swap-only .cno-primary-btn {
    display: none;
}

.cno-start-btn,
.cno-redeal-btn,
.cno-reveal-key-btn,
.cno-rematch-btn {
    width: 100%;
}

.cno-reveal-key-btn {
    margin-bottom: 8px;
}

.cno-redeal-btn {
    margin-top: 0;
}

.cno-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 12px;
}

.cno-home-btn {
    text-decoration: none;
}

.cno-admin-wrapper {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f7;
    min-height: calc(100vh - 70px - 60px);
    padding: 24px;
    margin: -20px;
}

.cno-admin-container {
    max-width: 900px;
    margin: 0 auto;
}

.cno-admin-subtitle {
    color: #555;
}

.cno-admin-toolbar {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
    margin: 16px 0;
}

.cno-admin-toolbar input[type="search"] {
    flex: 1;
    min-width: 200px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
}

.cno-admin-status {
    color: #666;
    margin-bottom: 8px;
}

.cno-admin-list {
    max-height: 60vh;
    overflow: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    margin-bottom: 16px;
}

.cno-admin-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.cno-admin-row:last-child {
    border-bottom: none;
}

.cno-admin-word {
    font-weight: 700;
    letter-spacing: 0.03em;
}

.cno-admin-meta {
    color: #888;
    font-size: 0.8em;
}

@media (max-width: 480px) {
    .cno-grid {
        gap: 4px;
    }

    .cno-tile {
        font-size: clamp(0.5rem, 2.5vw, 0.7rem);
        padding: 2px;
    }

    .cno-tile-badge {
        font-size: 0.44rem;
        padding: 0 3px;
        top: 1px;
        right: 1px;
    }

    .cno-turn-announce-name {
        font-size: 1.5rem;
    }

    .cno-guess-chip {
        font-size: 0.72rem;
        padding: 2px 6px;
    }

    .cno-compact-play.cno-has-guess-log .cno-grid-wrap {
        margin-bottom: 190px;
    }
}
