@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@600;700&family=Manrope:wght@400;500;600;700&display=swap');

:root {
    --ink: #0b1d26;
    --ink-soft: #2b3e47;
    --sea: #2f8d86;
    --sea-deep: #104654;
    --sand: #f4efe6;
    --sand-strong: #e5dccb;
    --mist: #d9e7e1;
    --accent: #d18b3a;
    --accent-strong: #b4712c;
    --danger: #b2483f;
    --danger-strong: #8f332e;
    --success: #3e8d7b;
    --card: rgba(255, 255, 255, 0.88);
    --line: rgba(11, 29, 38, 0.12);
    --shadow: 0 20px 50px rgba(11, 29, 38, 0.18);
    --soft-shadow: 0 10px 24px rgba(11, 29, 38, 0.12);
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --cell-size: 40px;
}

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

body {
    font-family: "Manrope", "Segoe UI", sans-serif;
    background: radial-gradient(1200px 700px at 10% -10%, #ffffff 0%, #f6f1e6 45%, #d9e7e1 100%);
    min-height: 100vh;
    color: var(--ink);
    line-height: 1.5;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(120deg, rgba(11, 29, 38, 0.08), rgba(11, 29, 38, 0) 60%),
        repeating-linear-gradient(0deg, rgba(11, 29, 38, 0.06) 0 1px, transparent 1px 26px),
        repeating-linear-gradient(90deg, rgba(11, 29, 38, 0.05) 0 1px, transparent 1px 26px);
    opacity: 0.45;
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: "";
    position: fixed;
    top: -120px;
    right: -80px;
    width: 420px;
    height: 420px;
    background: radial-gradient(circle at 30% 30%, rgba(209, 139, 58, 0.35), rgba(209, 139, 58, 0) 70%);
    opacity: 0.7;
    pointer-events: none;
    z-index: 0;
    animation: drift 16s ease-in-out infinite;
}

h1, h2, h3 {
    font-family: "Cormorant Garamond", "Times New Roman", serif;
    letter-spacing: 0.04em;
}

button, input {
    font-family: inherit;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    color: var(--ink);
    margin-bottom: 32px;
}

header h1 {
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    position: relative;
}

header h1::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 160px;
    height: 2px;
    transform: translateX(-50%);
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

.screen.active .login-card,
.screen.active .lobby-container,
.screen.active .game-header,
.screen.active .game-content {
    animation: rise-in 0.6s ease both;
}

.screen.active .game-content {
    animation-delay: 0.08s;
}

/* Login Screen */
.login-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 42px 36px;
    max-width: 420px;
    margin: 90px auto;
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
    backdrop-filter: blur(6px);
}

.login-card h2 {
    margin-bottom: 20px;
    text-align: center;
    color: var(--ink);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 1.4rem;
}

.login-card input {
    width: 100%;
    padding: 12px 14px;
    margin-bottom: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 16px;
    background: #fffaf2;
    box-shadow: inset 0 1px 3px rgba(11, 29, 38, 0.08);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-card input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(209, 139, 58, 0.2);
}

.login-card button,
.btn-primary {
    display: block;
    margin: 20px auto;
    width: max-content;
    padding: 14px 34px;
    background: linear-gradient(135deg, var(--ink), var(--sea-deep));
    color: #fdf7ef;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    box-shadow: 0 10px 20px rgba(11, 29, 38, 0.25);
    text-transform: uppercase;
    text-align: center;
}

.login-card button {
    width: 100%;
    margin-top: 6px;
}

.btn-primary:hover:not(:disabled),
.login-card button:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 26px rgba(11, 29, 38, 0.3);
    background: linear-gradient(135deg, var(--sea-deep), var(--ink));
}

.btn-primary:disabled {
    background: #9aa4a6;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.6;
}

.btn-primary.btn-disabled-hint {
    position: relative;
}

/* Lobby Screen (Menu des salons) */
#lobby-screen {
    max-width: 1100px;
    margin: 0 auto;
}

.lobby-container {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
    backdrop-filter: blur(6px);
}

.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 1px dashed var(--line);
    gap: 16px;
}

.lobby-header h2 {
    color: var(--ink);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.player-info-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.6);
    box-shadow: var(--soft-shadow);
}

.lobby-content {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.lobby-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.lobby-actions .btn-primary {
    margin: 0;
}

.lobby-rooms-section {
    background: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--line);
}

.lobby-rooms-section h3 {
    color: var(--ink);
    margin-bottom: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.current-room-section {
    background: rgba(47, 141, 134, 0.08);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid rgba(47, 141, 134, 0.3);
}

.current-room-section h3 {
    color: var(--ink);
    margin-bottom: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.room-info {
    margin-bottom: 18px;
}

.room-name-display {
    margin-bottom: 12px;
    font-size: 1.05em;
}

.players-in-room {
    margin-top: 12px;
}

/* Game Screen */
#game-screen {
    max-width: 1400px;
    margin: 0 auto;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(120deg, rgba(11, 29, 38, 0.95), rgba(16, 70, 84, 0.92));
    border-radius: var(--radius-lg);
    padding: 20px 30px;
    margin-bottom: 20px;
    box-shadow: var(--soft-shadow);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fdf7ef;
}

.game-header h2 {
    color: #fdf7ef;
    font-weight: 600;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.game-player-info {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #f6efe2;
}

.game-content {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
    backdrop-filter: blur(6px);
}

.game-phase {
    display: none;
}

.game-phase.active {
    display: block;
}

/* Ancien sidebar */
.sidebar {
    display: none;
}

.player-info {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px dashed var(--line);
}

.player-info h3 {
    margin-bottom: 10px;
    color: var(--ink);
    font-weight: 700;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-left: 10px;
}

.status-indicator.connected {
    background: var(--success);
    box-shadow: 0 0 8px rgba(62, 141, 123, 0.5);
}

.status-indicator.disconnected {
    background: #8f9a9d;
}

.menu-section {
    margin-bottom: 20px;
}

.menu-section h3 {
    margin-bottom: 15px;
    color: var(--ink);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.btn-secondary {
    padding: 12px 24px;
    background: transparent;
    color: var(--ink-soft);
    border: 1.5px solid var(--ink-soft);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.btn-secondary:hover {
    background: var(--ink);
    color: #fdf7ef;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(11, 29, 38, 0.2);
}

.btn-danger {
    padding: 12px 24px;
    background: var(--danger);
    color: #ffffff;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    font-size: 0.9rem;
    width: 100%;
    margin-top: 15px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.btn-danger:hover {
    background: var(--danger-strong);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(178, 72, 63, 0.3);
}

.btn-danger-small {
    padding: 8px 18px;
    background: var(--danger);
    color: #ffffff;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.btn-danger-small:hover {
    background: var(--danger-strong);
}

.rooms-list {
    margin-top: 15px;
}

.room-item {
    background: rgba(255, 255, 255, 0.85);
    padding: 12px 14px;
    margin-bottom: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--line);
    position: relative;
}

.room-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 4px;
    background: transparent;
    border-radius: 999px;
    transition: background 0.2s ease;
}

.room-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--soft-shadow);
    border-color: rgba(47, 141, 134, 0.4);
}

.room-item:hover::before {
    background: var(--accent);
}

.room-item .room-name {
    font-weight: 700;
    color: var(--ink);
}

.room-item .room-info {
    font-size: 0.9em;
    color: var(--ink-soft);
    margin-top: 5px;
}

.current-room {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed var(--line);
}

.current-room h3 {
    margin-bottom: 15px;
    color: var(--ink);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

#players-list {
    margin-bottom: 15px;
}

.player-item {
    background: rgba(255, 255, 255, 0.85);
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--line);
}

.player-item .host-badge {
    background: var(--ink);
    color: #ffffff;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.7em;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Game Area */
.game-area {
    padding: 20px;
}

.phase {
    display: none;
}

.phase.active {
    display: block;
}

.phase h2 {
    text-align: center;
    color: var(--ink);
    margin-bottom: 30px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.waiting-message {
    text-align: center;
    padding: 100px 20px;
    color: var(--ink-soft);
}

.waiting-message h2 {
    margin-bottom: 20px;
    color: var(--ink);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.loading-spinner {
    border: 4px solid rgba(11, 29, 38, 0.1);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    animation: spin 1s linear infinite;
    margin: 30px auto;
}

/* Boards */
.board-container, .boards-container {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.board-wrapper {
    text-align: center;
}

.board-wrapper h3 {
    margin-bottom: 15px;
    color: var(--ink);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.board {
    display: grid;
    grid-template-columns: repeat(10, var(--cell-size));
    grid-template-rows: repeat(10, var(--cell-size));
    gap: 3px;
    background: linear-gradient(135deg, #0b1d26, #133643);
    padding: 8px;
    border-radius: 16px;
    box-shadow: 0 18px 30px rgba(11, 29, 38, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.cell {
    background: #fefbf4;
    border: 1px solid rgba(11, 29, 38, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    position: relative;
    border-radius: 6px;
    color: var(--ink);
    overflow: hidden;
}

body.theme-love {
    --ink: #3a1c2a;
    --ink-soft: #6c3a52;
    --sea: #e26d94;
    --sea-deep: #b83a63;
    --sand: #fff3f6;
    --sand-strong: #f4dce6;
    --mist: #f6e7ee;
    --accent: #ff7fb0;
    --accent-strong: #e35f95;
    --danger: #c83a4a;
    --danger-strong: #9f2b3a;
    --success: #4a9b74;
}

body.theme-love {
    background: radial-gradient(900px 520px at 12% -10%, #fff8fb 0%, #f7e5ee 40%, #f3dbe6 100%);
}

body.theme-love::before {
    background-image:
        linear-gradient(120deg, rgba(58, 28, 42, 0.08), rgba(58, 28, 42, 0) 60%),
        repeating-linear-gradient(0deg, rgba(58, 28, 42, 0.06) 0 1px, transparent 1px 26px),
        repeating-linear-gradient(90deg, rgba(58, 28, 42, 0.05) 0 1px, transparent 1px 26px);
    opacity: 0.4;
}

body.theme-love::after {
    top: -140px;
    right: -100px;
    width: 460px;
    height: 460px;
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 127, 176, 0.35), rgba(255, 127, 176, 0) 70%),
        radial-gradient(circle at 70% 70%, rgba(226, 109, 148, 0.25), rgba(226, 109, 148, 0) 65%);
}

body.theme-love header h1::after {
    content: " ♥";
    color: var(--accent);
}

body.theme-love .hero-badge,
body.theme-love .host-badge {
    background: rgba(255, 127, 176, 0.14);
    border-color: rgba(255, 127, 176, 0.35);
}

body.theme-love .btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

body.theme-love .btn-primary:hover:not(:disabled) {
    box-shadow: 0 10px 22px rgba(255, 127, 176, 0.35);
}

body.theme-love .login-card,
body.theme-love .lobby-container,
body.theme-love .game-header,
body.theme-love .game-content {
    box-shadow: 0 16px 40px rgba(184, 58, 99, 0.18);
}

body.theme-love .game-status {
    border-color: rgba(255, 127, 176, 0.3);
    background: linear-gradient(90deg, rgba(255, 127, 176, 0.15), rgba(255, 255, 255, 0.6));
}

body.theme-love #turn-indicator {
    background: rgba(255, 127, 176, 0.16);
    border-color: rgba(255, 127, 176, 0.35);
    box-shadow: 0 10px 22px rgba(255, 127, 176, 0.2);
}

body.theme-love .board {
    background: linear-gradient(135deg, #fff6f9, #f6dfe8);
    border-color: rgba(184, 58, 99, 0.2);
}

body.theme-love .board-wrapper::before {
    border-color: rgba(255, 127, 176, 0.22);
}

body.theme-love .cell.ship {
    background: linear-gradient(135deg, rgba(255, 127, 176, 0.35), rgba(255, 206, 223, 0.6));
    border-color: rgba(255, 127, 176, 0.55);
}

body.theme-love .cell.hit {
    background: linear-gradient(135deg, #ff6f9a, #e23a6d);
    border-color: rgba(255, 255, 255, 0.5);
}

body.theme-love .cell.miss {
    background: #f7dbe6;
    border-color: #e8b9cc;
}

body.theme-love .cell.unknown {
    background: #fdeff4;
    border-color: #f0cad9;
}

body.theme-love .cell.hit::after,
body.theme-love .cell.miss::after,
body.theme-love .cell.sunk::after {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    text-shadow: 0 4px 10px rgba(255, 127, 176, 0.35);
    pointer-events: none;
    animation: heartPop 240ms ease;
}

body.theme-love .cell.hit::after {
    content: "\2764";
    color: #fff7fb;
    animation: heartPop 240ms ease, heartFloat 1.6s ease-in-out infinite;
}

body.theme-love .cell.miss::after {
    content: "\2661";
    color: #b65b7c;
}

body.theme-love .cell.sunk::after {
    content: "\2665";
    color: #fff;
    animation: heartPop 240ms ease, heartPulse 1.4s ease-in-out infinite;
}

body.theme-love #opponent-board .cell.attackable:hover:not(.hit):not(.miss):not(.sunk):not(.selected) {
    box-shadow: 0 10px 24px rgba(255, 127, 176, 0.35), 0 0 0 2px rgba(255, 127, 176, 0.3);
    border-color: rgba(255, 127, 176, 0.6);
}

body.theme-love .waiting-message h2::after {
    content: " \2665";
    color: var(--accent);
}

.cell:hover {
    background: #f2ede2;
    transform: scale(1.04);
}

.cell.empty {
    background: #fefbf4;
}

.cell.ship {
    background: linear-gradient(135deg, #2f7a78, #1f5f5b);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fdf7ef;
}

.cell.ship[data-vehicle] {
    border-color: var(--vehicle-accent, rgba(255, 255, 255, 0.5));
    box-shadow: inset 0 0 0 2px var(--vehicle-accent, rgba(255, 255, 255, 0.5));
}

.cell[data-vehicle]::before {
    content: "";
    position: absolute;
    inset: 2px;
    background-image: var(--vehicle-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 4px;
    opacity: 0.9;
    pointer-events: none;
}

.cell.hit[data-vehicle]::before {
    opacity: 0.45;
    filter: grayscale(0.2);
}

.cell.sunk[data-vehicle]::before {
    opacity: 0.25;
    filter: grayscale(1);
}

.cell.hit {
    background: radial-gradient(circle at 30% 30%, #f1b1aa, #b2483f);
    border-color: #7a2a24;
    color: #ffffff;
}

.cell.miss {
    background: radial-gradient(circle, rgba(255, 255, 255, 0.85) 0 3px, #9eb0b8 3px 100%);
    border-color: #7a8b92;
    color: var(--ink);
}

.cell.sunk {
    background: #2a2a2a;
    border-color: #1b1b1b;
    color: #ffffff;
}

.cell.unknown {
    background: #ebe4d8;
    border-color: #c6bcb0;
}

.cell.selected {
    background: #f4cf7a !important;
    border: 2px solid #d59b2d !important;
    transform: scale(1.08);
    box-shadow: 0 0 18px rgba(213, 155, 45, 0.45);
}

.cell.preview-valid {
    background: var(--preview-color, rgba(47, 141, 134, 0.25)) !important;
    border-color: var(--preview-border, rgba(47, 141, 134, 0.9)) !important;
    box-shadow: inset 0 0 0 2px var(--preview-border, rgba(47, 141, 134, 0.9));
}

.cell.preview-invalid {
    background: rgba(178, 72, 63, 0.25) !important;
    border-color: #b2483f !important;
    box-shadow: inset 0 0 0 2px #b2483f;
}

.cell.attackable {
    cursor: crosshair;
}

.cell.attackable:hover:not(.hit):not(.miss):not(.sunk) {
    background: rgba(47, 141, 134, 0.6);
    border-color: rgba(47, 141, 134, 0.9);
    color: #ffffff;
}

/* Ships Configuration */
.ships-config {
    background: rgba(255, 255, 255, 0.7);
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 30px;
    border: 1px solid var(--line);
}

.ships-config h3 {
    margin-bottom: 15px;
    color: var(--ink);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

#available-ships {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.ship-item {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
    box-shadow: var(--soft-shadow);
}

.ship-item:hover:not(.placed) {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.ship-item.selected {
    border-color: var(--sea);
    background: rgba(47, 141, 134, 0.08);
    box-shadow: 0 12px 24px rgba(47, 141, 134, 0.25);
}

.ship-item.placed {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f0ebe0;
    border-color: #b7b0a3;
}

.ship-item .ship-name {
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ship-thumb {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #f7f3ea;
    padding: 2px;
}

.ship-label {
    display: inline-block;
}

.ship-item .ship-size {
    font-size: 0.9em;
    color: var(--ink-soft);
}

.ship-item .ship-status {
    font-size: 0.85em;
    color: var(--sea);
    font-weight: 700;
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.game-status {
    background: rgba(255, 255, 255, 0.7);
    padding: 15px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid var(--line);
}

#game-info {
    min-height: 28px;
}

.attack-controls {
    margin-top: 20px;
    text-align: center;
}

.selected-cell-info {
    margin-bottom: 10px;
    color: #666;
}

.attack-hint {
    margin-top: 10px;
    font-size: 0.9em;
    color: #999;
}

#attack-controls {
    transition: opacity 0.2s ease;
}

.rematch-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 16px 0 8px;
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(11, 29, 38, 0.12);
    border-radius: var(--radius-md);
    box-shadow: var(--soft-shadow);
    backdrop-filter: blur(6px);
}

.rematch-message {
    font-weight: 600;
    color: var(--ink);
}

.rematch-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.rematch-panel.rematch-waiting {
    opacity: 0.9;
}

.rematch-panel.rematch-waiting .btn-primary {
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

.create-room-panel {
    margin-top: 12px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-md);
    padding: 18px;
    border: 1px solid var(--line);
}

.create-room-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.create-room-fields label {
    color: var(--ink-soft);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.create-room-fields input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 16px;
    background: #fffaf2;
    box-shadow: inset 0 1px 3px rgba(11, 29, 38, 0.08);
}

.form-error {
    min-height: 18px;
    color: var(--danger);
    font-size: 0.85rem;
    font-weight: 600;
}

.create-room-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 12px;
}

.create-room-actions .btn-primary,
.create-room-actions .btn-secondary {
    margin: 0;
    height: 46px;
    padding: 0 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}


.game-status h3 {
    color: var(--ink);
    margin-bottom: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.placement-status {
    text-align: center;
    margin-top: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.placement-status.status-ready {
    background: rgba(47, 141, 134, 0.12);
    color: var(--sea);
    border: 1px solid rgba(47, 141, 134, 0.4);
}

.placement-status.status-waiting {
    background: rgba(11, 29, 38, 0.06);
    color: var(--ink-soft);
    border: 1px solid var(--line);
}

.placement-status {
    transition: all 0.3s;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes drift {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-20px, 25px) rotate(3deg); }
}

@keyframes heartPop {
    0% { transform: scale(0.6); opacity: 0; }
    80% { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes heartFloat {
    0% { transform: translateY(2px); }
    50% { transform: translateY(-2px); }
    100% { transform: translateY(2px); }
}

@keyframes heartPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

@media (max-width: 1024px) {
    .lobby-container,
    .game-content {
        padding: 26px;
    }
}

@media (max-width: 768px) {
    :root {
        --cell-size: 30px;
    }

    .container {
        padding: 16px;
    }

    header h1 {
        letter-spacing: 0.08em;
    }

    .lobby-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .lobby-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .game-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .board-container, .boards-container {
        gap: 20px;
    }

    .boards-container {
        flex-direction: column;
    }
}

@media (max-width: 520px) {
    :root {
        --cell-size: 26px;
    }

    .login-card {
        margin: 60px 12px;
        padding: 32px 24px;
    }

    .game-header {
        padding: 16px 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}


