   :root {
      --text: #172033;
      --muted: #1f2a44;
      --accent: #2f90c0;
      --blue-deep: #0f4d66;
      --panel: rgba(255, 255, 255, .62);
   }

   /* background not card*/
   body {
      position: relative;
      margin: 0;
      min-height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 16px;
  background:radial-gradient(circle at top,
    #eff6ff 0%,
    #dbeafe 45%,
    #93c5fd 100%);
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, sans-serif;
      color: var(--text);
    }

body > :not(#penrose) {
    position: relative;
    z-index: 1;
}

.hangman-page *,
.hangman-page *::before,
.hangman-page *::after {
    box-sizing: border-box;
}

/* Psybites redesign layer */
.hangman-page {
    align-items: flex-start;
    justify-content: center;
    padding: 0 16px 16px;
    background:
        radial-gradient(circle at 20% 0%, rgba(246, 191, 69, .16), transparent 28%),
        radial-gradient(circle at 86% 6%, rgba(78, 158, 190, .14), transparent 34%),
        radial-gradient(circle at top, #fffaf0 0%, #eef7f5 48%, #dbeafe 100%);
}

.hangman-page .room-panel,
.hangman-page .room-panel-show {
    display: none;
}

.game {
    width: min(100%, 1040px);
    max-width: 1040px;
    min-height: auto;
    margin: 0 auto;
    padding: 0 22px 22px;
    border-radius: 24px;
    overflow: visible;
}

.hangman-page {
    overflow-x: hidden;
}

.hangman-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px 0 13px;
    margin: 0 0 18px;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 0;
}

.hangman-topbar h1 {
    color: var(--blue-deep);
    font-size: clamp(1.9rem, 4.6vw, 3.2rem);
    line-height: .98;
    letter-spacing: .08em;
}

.hangman-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.hangman-action-button {
    position: relative;
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    overflow: hidden;
    border: 1px solid rgba(86, 151, 178, .28);
    border-radius: 999px;
    background:
        radial-gradient(circle at 48% 0%, rgba(255, 255, 255, .68), transparent 45%),
        linear-gradient(180deg, rgba(246, 253, 255, .62), rgba(214, 238, 248, .44));
    color: #111820;
    box-shadow:
        0 3px 0 rgba(48, 72, 88, .1),
        0 10px 18px rgba(38, 76, 102, .1),
        inset 0 1px 0 rgba(255, 255, 255, .78);
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    text-decoration: none;
    touch-action: manipulation;
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
    -webkit-tap-highlight-color: transparent;
}

.hangman-action-button:hover {
    transform: translateY(-1px);
    filter: saturate(1.05);
    box-shadow:
        0 3px 0 rgba(55, 45, 30, .13),
        0 13px 22px rgba(45, 36, 23, .13),
        inset 0 1px 0 rgba(255, 255, 255, .56);
}

.hangman-action-button:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 rgba(55, 45, 30, .16), 0 5px 10px rgba(45, 36, 23, .08);
}

.premium-button {
    border-color: rgba(197, 138, 37, .62);
    background:
        radial-gradient(circle at 48% 0%, rgba(255, 255, 255, .36), transparent 42%),
        linear-gradient(135deg, #b97815, #f4bd3f 58%, #d99420);
    color: #fff;
    isolation: isolate;
    text-align: center;
    text-shadow: 0 1px 0 rgba(90, 52, 7, .24);
}

.premium-button::after {
    content: "";
    position: absolute;
    top: -45%;
    left: -75%;
    width: 42px;
    height: 190%;
    z-index: 1;
    background:
        linear-gradient(90deg, transparent, rgba(255, 255, 255, .86), rgba(255, 246, 178, .98), transparent);
    opacity: .02;
    pointer-events: none;
    transform: rotate(22deg);
    animation: hangman-premium-glint 180s ease-in-out infinite;
}

@keyframes hangman-premium-glint {
    0%,
    96% {
        left: -75%;
        opacity: .02;
    }
    96.8% {
        opacity: .95;
    }
    98.2%,
    100% {
        left: 125%;
        opacity: .02;
    }
}

.settings-panel.open {
    max-height: min(540px, calc(100svh - 130px));
    margin-bottom: 18px;
    overflow: auto;
}

.board {
    display: grid;
    grid-template-columns: minmax(260px, .78fr) minmax(360px, 1fr);
    gap: clamp(16px, 3vw, 30px);
    align-items: start;
}

.hangman {
    display: grid;
    gap: 12px;
    align-content: start;
}

.hangman-svg {
    width: min(100%, 300px);
    max-width: none;
    border-color: rgba(7, 4, 10, .16);
    border-radius: 8px;
    background: rgba(255, 255, 255, .22);
}

.hint {
    margin: 0;
    color: #111820;
    font-weight: 850;
    line-height: 1.32;
}

.play-panel {
    display: grid;
    gap: 14px;
}

.hangman-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    justify-self: end;
    width: min(190px, 100%);
}

.lives,
#timer-text {
    min-height: 40px;
    justify-content: center;
    padding: 8px 12px;
    border: 1px solid rgba(86, 151, 178, .22);
    border-radius: 999px;
    background:
        radial-gradient(circle at 48% 0%, rgba(255, 255, 255, .62), transparent 45%),
        linear-gradient(180deg, rgba(246, 253, 255, .64), rgba(214, 238, 248, .48));
    box-shadow:
        0 3px 0 rgba(48, 72, 88, .08),
        inset 0 1px 0 rgba(255, 255, 255, .72);
    color: #111820;
    font-size: .84rem;
    font-weight: 900;
}

#timer-text {
    top: 0;
    display: inline-flex;
    align-items: center;
}

.word-wrapper {
    border-color: rgba(86, 151, 178, .2);
    background:
        radial-gradient(circle at 48% 0%, rgba(255, 255, 255, .58), transparent 44%),
        linear-gradient(180deg, rgba(246, 253, 255, .58), rgba(214, 226, 248, .42));
}

.keyboard {
    grid-template-columns: repeat(9, minmax(34px, 1fr));
    gap: 8px;
}

.key {
    min-height: 38px;
    touch-action: manipulation;
}

.footer {
    justify-content: center;
}

@media (max-width: 760px) {
    .hangman-page {
        padding: 0 8px 10px;
    }

    .game {
        width: min(100%, 520px);
        padding: 0 12px 14px;
        border-radius: 18px;
    }

    .hangman-topbar {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-bottom: 12px;
        padding: 8px 0 10px;
    }

    .hangman-topbar h1 {
        text-align: center;
        font-size: clamp(1.45rem, 8.5vw, 2rem);
        letter-spacing: .07em;
    }

    .hangman-actions {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
        width: 100%;
    }

    .hangman-action-button {
        min-height: 36px;
        padding: 0 6px;
        font-size: clamp(.68rem, 3.2vw, .84rem);
        line-height: 1.04;
        text-align: center;
    }

    .board {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .hangman-svg {
        width: min(100%, 220px);
        max-height: 28svh;
    }

    .hint {
        font-size: .86rem;
    }

    .hangman-stats {
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .lives,
    #timer-text {
        min-height: 34px;
        padding: 6px 8px;
        font-size: .72rem;
        letter-spacing: .06em;
    }

    .word-wrapper {
        min-height: 64px;
        padding: 10px;
    }

    .keyboard {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 5px;
    }

    .key {
        min-height: 33px;
        padding: 0;
    }
}

@media (orientation: landscape) and (max-height: 520px) and (max-width: 1000px) {
    .hangman-page {
        padding: 0 6px 8px;
    }

    .game {
        width: min(100%, 940px);
        min-height: calc(100svh - 8px);
        padding: 0 12px 9px;
    }

    .hangman-topbar {
        grid-template-columns: minmax(120px, .8fr) minmax(360px, 1fr);
        gap: 10px;
        margin-bottom: 5px;
        padding: 3px 0 4px;
    }

    .hangman-topbar h1 {
        font-size: clamp(1.1rem, 6svh, 1.65rem);
        text-align: left;
    }

    .hangman-actions {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }

    .hangman-action-button {
        min-height: 28px;
        padding: 0 7px;
        font-size: .66rem;
    }

    .settings-panel.open {
        max-height: calc(100svh - 62px);
        margin-bottom: 8px;
    }

    .board {
        grid-template-columns: minmax(180px, 30svw) minmax(420px, 1fr);
        gap: 12px;
    }

    .hangman-svg {
        width: min(100%, 210px);
        max-height: calc(100svh - 128px);
    }

    .hint {
        font-size: .76rem;
        line-height: 1.16;
    }

    .play-panel {
        gap: 8px;
    }

    .hangman-stats {
        grid-template-columns: 1fr;
        width: 142px;
        justify-self: end;
    }

    .lives,
    #timer-text {
        min-height: 29px;
        padding: 4px 8px;
        font-size: .68rem;
    }

    .word-wrapper {
        min-height: 62px;
        padding: 9px 10px;
    }

    .keyboard {
        margin-top: 0;
        grid-template-columns: repeat(13, minmax(0, 1fr));
        gap: 5px;
    }

    .key {
        min-height: 29px;
        font-size: .72rem;
    }

    .footer {
        margin-top: 7px;
    }
}
/* the card which the game sits on*/
    .game {
      position: relative;
      overflow: hidden;
      width: 100%;
      max-width: 640px;
   background:
    radial-gradient(circle at 14% 0%, rgba(255, 213, 79, 0.26), transparent 32%),
    radial-gradient(circle at 92% 14%, rgba(74, 126, 245, 0.16), transparent 34%),
    linear-gradient(135deg, rgba(218, 235, 218, 0.74), rgba(219, 231, 245, 0.62) 54%, rgba(246, 238, 213, 0.56));

backdrop-filter: blur(12px);
      border-radius: 24px;
      padding: 24px 20px 20px;
      box-shadow:
        0 18px 60px rgba(2, 56, 126, 0.736),
        0 0 0 1px rgba(148, 163, 184, 0.08);
          border: 1px solid rgba(7, 4, 10, 0.25);
    } /* this is the shadow of the card*/

    .game::before {
      content: "";
      position: absolute;
      inset: 0;
      border-radius: inherit;
      background:
        linear-gradient(120deg, rgba(255,255,255,0.24), transparent 42%),
        radial-gradient(circle at 50% 100%, rgba(47, 95, 227, 0.08), transparent 44%);
      pointer-events: none;
    }

    .game > * {
      position: relative;
      z-index: 1;
    }

/* this is lives and time position */
    .game-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 20px;
      
    }
/* this changes the card */
    h1 {
      margin: 0;
      font-size: 2.25rem;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: var(--muted);
    }
    /* this changes the lives and the timer*/
       .lives {
      padding: 6px 10px;
      border-radius: 999px;
      border: 1px solid rgba(7, 4, 10, 0.25);
      font-size: 0.8rem;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: black;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      backdrop-filter: blur(4px);
      background: linear-gradient( 135deg, #dbe7f5 0%,#d6dff2 50%, #cfd7ee 100%);
    }

    #timer-text {
      position: relative;
      top: 2px;
    }

/* this put the guesses box and the hangman box next to each other*/
    .board {
      display: grid;
      grid-template-columns: 250px 1fr;
      align-items: stretch;
    }

    /* Word display */
    .word-wrapper {
      border-radius: 18px;
      padding: 14px 14px 16px;
      background: linear-gradient( 135deg, #dbe7f5 0%,#d6dff2 50%, #cfd7ee 100%);
      border: 1px solid rgba(7, 4, 10, 0.25);
      display: flex;
      flex-direction: column;
      gap: 10px;
      min-height: 90px;
      justify-content: space-between;
    }
        .word {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      font-size: 1.6rem;
      letter-spacing: 0.1em;
    }

    .letter-box {
      min-width: 22px;
      text-align: center;
      border-bottom: 2px solid rgba(7, 4, 10, 0.25);
      padding-bottom: 4px;
      text-transform: uppercase;
    }
    .letter-box.revealed {
      color: var(--accent);
      text-shadow: 0 0 8px rgba(56, 189, 248, 0.9);
    }

    .status { font-size: 0.85rem; color: var(--muted); }
    .status strong { color: var(--accent); }

    /* Keyboard */
    .keyboard {
      margin-top: 16px;
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(28px, 1fr));
      gap: 6px;
    }
    .key {
      padding: 6px 0;
      border-radius: 999px;
      border: 1px solid rgba(7, 4, 10, 0.25);
      background: linear-gradient( 135deg, #dbe7f5 0%,#cadafc 50%, #b6c4ef 100%);
      font-size: 0.8rem;
      text-transform: uppercase;
      cursor: pointer;
      color: var(--text);
      transition: transform 0.08s ease-out, box-shadow 0.08s ease-out,
       border-color 0.1s ease-out, background 0.1s ease-out;
      user-select: none;
       
    }

    .key:hover:not(:disabled) {
      transform: translateY(-1px);
      box-shadow: 0 6px 14px rgba(74, 113, 206, 0.8);
      border: 1px solid rgba(7, 4, 10, 0.25);
    }
  .key:active:not(:disabled) { transform: translateY(0); box-shadow: none; }

    .key.correct {
      background: radial-gradient(circle at top, rgba(22, 163, 74, 0.4), #11bd8f);
      border: 1px solid rgba(7, 4, 10, 0.25);
    }

    .key.wrong {
      background: radial-gradient(circle at top, rgba(255, 57, 57, 0.6), #6f9dff);
      border: 1px solid rgba(7, 4, 10, 0.25);
      color: #fecaca;
    }

    .key:disabled { opacity: 0.85; cursor: default; }

    .footer {
      margin-top: 16px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      font-size: 0.8rem;
      color: var(--muted);
    }
    /* this is the new word button*/ 
    .btn {
      padding: 7px 14px;
      border-radius: 999px;
      border: 1px solid rgba(7, 4, 10, 0.25);
      background: linear-gradient( 135deg, #dbe7f5 0%,#bec8df 50%, #cfd7ee 100%);
      color: var(--text);
      font-size: 0.8rem;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      transition: transform 0.1s ease-out, box-shadow 0.1s ease-out,
      border-color 0.1s ease-out, background 0.1s ease-out;
      white-space: nowrap;
    }

    .btn:hover {
      transform: translateY(-1px);
      box-shadow: 0 10px 22px rgba(67, 103, 187, 0.85);
      border-color: var(--accent);
    }
  .btn:active { transform: translateY(0); box-shadow: none; }

    .message { font-size: 0.9rem; color: var(--muted); }
    .message.win { color: #050e08; }
    .message.lose { color: var(--error); }

    .answer {
      font-weight: 600;
      color: #020408;
      text-transform: uppercase;
    }
#penrose {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}
/* setting button*/ 

.settings-panel {
    max-height: 0;
    overflow: hidden;
    padding: 0 16px;
    margin-bottom: 0;
    border-radius: 18px;
    background: #dbe7f5;
    transition:
        max-height .35s ease,
        padding .35s ease,
        margin .35s ease;
}
.settings-btn.open {
    transform: rotate(90deg);
}
       
.settings-panel.open {
   max-height: 450px;
    padding: 16px;
    margin-bottom: 20px;
background:
    radial-gradient(
        circle at top left,
        rgba(255,255,255,.45),
        transparent 45%
    ),

    linear-gradient(
        135deg,
        #eef8ff,
        #dcecff,
        #d5e2ff
    );
    padding:16px;
    margin-bottom:20px;
    box-shadow:
        0 18px 60px rgba(2,56,126,.736),
        0 0 0 1px rgba(148,163,184,.08);
}

.settings {
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-btn {
  
    position: relative;
    width: 40px;
   height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(7, 4, 10, 0.25);
    transition: transform 0.4s ease, box-shadow 0.2s ease;
   background: linear-gradient(
    135deg,
    rgba(19, 120, 12, 0.15),
    rgba(1, 255, 255, 0.05)
  
    );

    cursor: pointer;
    font-size: 18px;
}

.help-btn {
    font-weight: 800;
    color: #05284a;
}

.settings-btn:hover {
    transform: rotate(20deg) scale(1.1);
    box-shadow: 0 6px 16px rgba(67, 103, 187, 0.8);
}
settings-panel label {
  
    display: flex;
    align-items: center;
    gap: 8px;
    color: black;
    font-size: 16px;
}

.hangman-part {
    opacity: 0;
    transform-origin: center;
    transition: opacity .22s ease, stroke-dashoffset .34s ease, transform .24s ease;
}

line.hangman-part {
    stroke-dasharray: 240;
    stroke-dashoffset: 240;
}

circle.hangman-part {
    stroke-dasharray: 80;
    stroke-dashoffset: 80;
    transform: scale(.86);
}

.hangman-watermark {
    opacity: .18;
    color: #2f6f88;
    transition: opacity .22s ease, transform .28s ease;
    transform-origin: center;
}

.hangman-watermark circle,
.hangman-watermark path {
    fill: none;
    stroke: currentColor;
    stroke-width: 4;
    stroke-linecap: round;
}

.hangman-watermark text {
    fill: currentColor;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: .18em;
    text-anchor: middle;
    text-transform: uppercase;
}

.hangman-watermark.is-hidden {
    opacity: 0;
    transform: scale(.96);
}

.hangman-part.is-visible {
    opacity: 1;
    stroke-dashoffset: 0;
    transform: scale(1);
}
.hangman-svg {
    width: 100%;
    max-width: 220px;
    height: auto;
    border: 1px solid black;
    display: block;
    margin: 0 auto;
}
.settings-panel input[type="number"] {
    width: 70px;
    padding: 8px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,.2);
    text-align: center;
    font-size: 18px;
    background: white;
}

.settings-panel select {
    min-width: 150px;
    padding: 8px 12px;
    border: 1px solid rgba(0,0,0,.2);
    border-radius: 12px;
    background: white;
    color: #172033;
    font: 800 16px/1.2 'Fredoka', sans-serif;
}

.premium-hint-setting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 16px 0;
}

.premium-hint-setting label {
    flex: 1 1 auto;
    margin: 0;
}

.premium-hint-setting select {
    flex: 0 0 auto;
}
.settings-panel label {
    font-family: 'Fredoka', sans-serif;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 14px 0;
    
}
.settings-panel h3 {
 font-family: 'Fredoka', serif;
 font-size: 28px;
 font-weight: bold;
 margin-top: 0;
 margin-bottom: 18px;
 text-align: center;
 letter-spacing: 2px;
 position: relative;
  text-align: center;
  margin-bottom: 35px;
}

.switch-row{

    display:flex;
    justify-content:space-between;
    align-items:center;
    margin:16px 0;
}
    
.switch{

    position:relative;
    display:inline-block;
    width:56px;
    height:30px;
}
.switch input{
    opacity:0;
    width:0;
    height:0;
}
.slider{

    position:absolute;
    cursor:pointer;
    top:0;
    left:0;
    right:0;
    bottom:0;
    background:#bbb;
    border-radius:30px;
    transition:.3s;
}
.slider::before{

    content:"";
    position:absolute;
    width:22px;
    height:22px;
    left:4px;
    bottom:4px;
    background:white;
    border-radius:50%;
    transition:.3s;
}
    
.switch input:checked + .slider{

    background:#4CAF50;
}
.switch input:checked + .slider::before{

    transform:translateX(26px);
}

.title-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: -25px 0 -15px;
}

.line {
    flex: 1;
    height: 3px;
    background: linear-gradient(
        90deg,
        #5b7cfa,
        #63d8ff
    );
}

.divider-flower {
    width: 28px;
    height: 28px;
    display: block;
   
}
.setting-icon {
    width: 50px;
    height: 50px;
    margin-right: 10px;
    vertical-align: middle;
  
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.help-modal[hidden] {
    display: none;
}

.help-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    width: 100vw;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 18px;
    background: rgba(8, 20, 38, 0.44);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.help-card {
    position: relative;
    width: min(460px, calc(100vw - 28px));
    max-height: calc(100vh - 28px);
    max-height: calc(100dvh - 28px);
    overflow: auto;
    border-radius: 22px;
    padding: 24px;
    color: #05284a;
    background:
        radial-gradient(circle at 10% 0%, rgba(255, 213, 79, 0.22), transparent 34%),
        radial-gradient(circle at 100% 18%, rgba(74, 126, 245, 0.18), transparent 36%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(221, 236, 250, 0.88));
    border: 1px solid rgba(7, 4, 10, 0.18);
    box-shadow: 0 22px 70px rgba(2, 56, 126, 0.45);
}

.help-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(7, 4, 10, 0.18);
    background: rgba(255, 255, 255, 0.72);
    color: #05284a;
    cursor: pointer;
    font-weight: 800;
}

.help-kicker {
    margin: 0 0 6px;
    color: #b77812;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.72rem;
    font-weight: 800;
}

.help-card h2 {
    margin: 0 0 14px;
    font-size: 2rem;
}

.help-card p {
    margin: 0 0 10px;
    color: #334155;
    line-height: 1.45;
}

.help-card .btn {
    margin-top: 8px;
}

@media (max-width: 640px) and (orientation: portrait) {
    body {
        min-height: 100svh;
        align-items: flex-start;
        padding: 8px;
    }

    .game {
        max-width: 430px;
        min-height: calc(100svh - 16px);
        padding: 14px 12px 12px;
        border-radius: 18px;
        overflow: visible;
    }

    .game > .room-panel.room-panel-live-only {
        margin-bottom: 10px;
    }

    .game-header {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 8px;
        align-items: center;
        margin-bottom: 10px;
    }

    h1 {
        font-size: clamp(1.45rem, 9vw, 2rem);
        letter-spacing: 0.08em;
        line-height: 1;
    }

    .settings {
        gap: 6px;
    }

    .settings-btn {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }

    .header-info {
        grid-column: 1 / -1;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
    }

    .lives {
        min-height: 30px;
        padding: 5px 9px;
        font-size: 0.7rem;
        letter-spacing: 0.06em;
    }

    #timer-text {
        top: 0;
        min-height: 30px;
        display: inline-flex;
        align-items: center;
        padding: 5px 9px;
        border: 1px solid rgba(7, 4, 10, 0.18);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.44);
        font-weight: 800;
    }

    .settings-panel.open {
        max-height: calc(100svh - 120px);
        padding: 12px;
        margin-bottom: 10px;
        overflow: auto;
    }

    .settings-panel h3 {
        margin-bottom: 22px;
        font-size: 1.4rem;
    }

    .settings-panel label,
    .switch-row {
        margin: 10px 0;
        font-size: 0.94rem;
    }

    .setting-icon {
        width: 34px;
        height: 34px;
    }

    .board {
        display: grid;
        grid-template-columns: 1fr;
        gap: 9px;
        align-items: stretch;
    }

    .hangman {
        display: grid;
        gap: 6px;
    }

    .hangman-svg {
        max-width: min(100%, 210px);
        max-height: 29svh;
        border-color: rgba(7, 4, 10, 0.18);
        background: rgba(255, 255, 255, 0.2);
    }

    .hint {
        margin: 0;
        font-size: 0.88rem;
        font-weight: 800;
        line-height: 1.25;
    }

    .word-wrapper {
        min-height: 64px;
        padding: 10px;
        border-radius: 14px;
        gap: 7px;
    }

    .word {
        justify-content: center;
        gap: 6px;
        font-size: clamp(1.15rem, 6vw, 1.45rem);
    }

    .letter-box {
        min-width: 18px;
    }

    .status {
        text-align: center;
        font-size: 0.78rem;
    }

    .keyboard {
        margin-top: 9px;
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 5px;
    }

    .key {
        min-height: 32px;
        padding: 0;
        font-size: 0.78rem;
    }

    .footer {
        margin-top: 10px;
        justify-content: center;
        gap: 6px;
        text-align: center;
    }

    .btn {
        min-height: 34px;
        padding: 6px 12px;
        font-size: 0.72rem;
    }

    .message {
        width: 100%;
        min-height: 18px;
        font-size: 0.78rem;
    }
}

@media (orientation: landscape) and (max-height: 520px) and (max-width: 1000px) {
    body {
        min-height: 100svh;
        align-items: flex-start;
        padding: 6px;
        overflow-x: hidden;
    }

    .game {
        width: min(100%, 900px);
        max-width: none;
        min-height: calc(100svh - 12px);
        padding-top: 42px;
        padding-right: 14px;
        padding-bottom: 9px;
        padding-left: 14px;
        border-radius: 18px;
        overflow: visible;
    }

    .game > .room-panel.room-panel-live-only {
        position: absolute;
        top: 8px;
        right: 14px;
        z-index: 3;
        margin: 0;
    }

    .game > .room-panel-live-only .room-panel-live {
        min-height: 32px;
        padding: 0 14px;
        font-size: 0.72rem;
    }

    .game > .room-panel-live-only button.room-panel-close {
        width: 30px;
        min-width: 30px;
        min-height: 30px;
    }

    .game-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto;
        gap: 8px 12px;
        align-items: center;
        margin-bottom: 8px;
    }

    h1 {
        font-size: clamp(1.5rem, 7svh, 2rem);
        letter-spacing: 0.1em;
        line-height: 1;
    }

    .settings {
        gap: 6px;
    }

    .settings-btn {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }

    .header-info {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .lives {
        min-height: 30px;
        padding: 5px 10px;
        font-size: 0.7rem;
        letter-spacing: 0.08em;
    }

    #timer-text {
        top: 0;
        min-width: 40px;
        font-size: 0.86rem;
        font-weight: 800;
    }

    .settings-panel.open {
        max-height: calc(100svh - 88px);
        padding: 10px 12px;
        margin-bottom: 8px;
        overflow: auto;
    }

    .board {
        grid-template-columns: minmax(190px, 33svw) minmax(310px, 1fr);
        gap: 12px;
        align-items: start;
    }

    .hangman {
        display: grid;
        gap: 6px;
        align-content: start;
    }

    .hangman-svg {
        width: min(100%, 230px);
        max-height: calc(100svh - 190px);
        border-color: rgba(7, 4, 10, 0.18);
        background: rgba(255, 255, 255, 0.2);
    }

    .hint {
        margin: 0;
        font-size: 0.78rem;
        font-weight: 800;
        line-height: 1.18;
    }

    .word-wrapper {
        min-height: 76px;
        padding: 11px 12px;
        border-radius: 14px;
        gap: 8px;
    }

    .word {
        gap: 7px;
        font-size: clamp(1.08rem, 5.4svh, 1.5rem);
    }

    .letter-box {
        min-width: 18px;
    }

    .status {
        font-size: 0.78rem;
        line-height: 1.2;
    }

    .keyboard {
        margin-top: 10px;
        grid-template-columns: repeat(13, minmax(0, 1fr));
        gap: 5px;
    }

    .key {
        min-height: 29px;
        padding: 0;
        font-size: 0.74rem;
    }

    .footer {
        margin-top: 8px;
        gap: 8px;
        font-size: 0.74rem;
    }

    .btn {
        min-height: 32px;
        padding: 5px 12px;
        font-size: 0.7rem;
    }

    .message {
        font-size: 0.76rem;
    }
}

/* Final Hangman layout overrides */
body.hangman-page {
    align-items: flex-start;
    justify-content: center;
    padding: 0 16px 16px;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 20% 0%, rgba(246, 191, 69, .16), transparent 28%),
        radial-gradient(circle at 86% 6%, rgba(78, 158, 190, .14), transparent 34%),
        radial-gradient(circle at top, #fffaf0 0%, #eef7f5 48%, #dbeafe 100%);
}

.hangman-page .room-panel,
.hangman-page .room-panel-show {
    display: none;
}

.hangman-page .game {
    width: min(100%, 1040px);
    max-width: 1040px;
    min-height: auto;
    margin: 0 auto;
    padding: 0 22px 22px;
    border-radius: 24px;
    overflow: visible;
}

.hangman-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px 0 13px;
    margin: 0 0 18px;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 0;
}

.hangman-topbar h1 {
    margin: 0;
    color: var(--blue-deep);
    font-size: clamp(1.9rem, 4.6vw, 3.2rem);
    line-height: .98;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.hangman-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.hangman-action-button {
    position: relative;
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    overflow: hidden;
    border: 1px solid rgba(86, 151, 178, .28);
    border-radius: 999px;
    background:
        radial-gradient(circle at 48% 0%, rgba(255, 255, 255, .68), transparent 45%),
        linear-gradient(180deg, rgba(246, 253, 255, .62), rgba(214, 238, 248, .44));
    color: #111820;
    box-shadow:
        0 3px 0 rgba(48, 72, 88, .1),
        0 10px 18px rgba(38, 76, 102, .1),
        inset 0 1px 0 rgba(255, 255, 255, .78);
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    text-decoration: none;
    touch-action: manipulation;
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
    -webkit-tap-highlight-color: transparent;
}

.hangman-action-button:hover {
    transform: translateY(-1px);
    filter: saturate(1.05);
    box-shadow:
        0 3px 0 rgba(55, 45, 30, .13),
        0 13px 22px rgba(45, 36, 23, .13),
        inset 0 1px 0 rgba(255, 255, 255, .56);
}

.hangman-action-button:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 rgba(55, 45, 30, .16), 0 5px 10px rgba(45, 36, 23, .08);
}

.hangman-action-button.premium-button {
    border-color: rgba(197, 138, 37, .62);
    background:
        radial-gradient(circle at 48% 0%, rgba(255, 255, 255, .36), transparent 42%),
        linear-gradient(135deg, #b97815, #f4bd3f 58%, #d99420);
    color: #fff;
    isolation: isolate;
    text-align: center;
    text-shadow: 0 1px 0 rgba(90, 52, 7, .24);
}

.hangman-action-button.premium-button::after {
    content: "";
    position: absolute;
    top: -45%;
    left: -75%;
    width: 42px;
    height: 190%;
    z-index: 1;
    background:
        linear-gradient(90deg, transparent, rgba(255, 255, 255, .86), rgba(255, 246, 178, .98), transparent);
    opacity: .02;
    pointer-events: none;
    transform: rotate(22deg);
    animation: hangman-premium-glint 180s ease-in-out infinite;
}

.hangman-page .settings-panel.open {
    max-height: min(540px, calc(100svh - 130px));
    margin-bottom: 18px;
    overflow: auto;
}

.hangman-page .board {
    display: grid;
    grid-template-columns: minmax(260px, .78fr) minmax(360px, 1fr);
    gap: clamp(16px, 3vw, 30px);
    align-items: start;
}

.hangman-page .hangman {
    display: grid;
    gap: 12px;
    align-content: start;
}

.hangman-page .hangman-svg {
    width: min(100%, 300px);
    max-width: none;
    border-color: rgba(7, 4, 10, .16);
    border-radius: 8px;
    background: rgba(255, 255, 255, .22);
}

.hangman-page .hint {
    margin: 0;
    color: #111820;
    font-weight: 850;
    line-height: 1.32;
}

.play-panel {
    display: grid;
    gap: 14px;
}

.hangman-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    justify-self: end;
    width: min(190px, 100%);
}

.hangman-page .lives,
.hangman-page #timer-text {
    min-height: 40px;
    justify-content: center;
    padding: 8px 12px;
    border: 1px solid rgba(86, 151, 178, .22);
    border-radius: 999px;
    background:
        radial-gradient(circle at 48% 0%, rgba(255, 255, 255, .62), transparent 45%),
        linear-gradient(180deg, rgba(246, 253, 255, .64), rgba(214, 238, 248, .48));
    box-shadow:
        0 3px 0 rgba(48, 72, 88, .08),
        inset 0 1px 0 rgba(255, 255, 255, .72);
    color: #111820;
    font-size: .84rem;
    font-weight: 900;
}

.hangman-page #timer-text {
    top: 0;
    display: inline-flex;
    align-items: center;
}

.hangman-page .word-wrapper {
    border-color: rgba(86, 151, 178, .2);
    background:
        radial-gradient(circle at 48% 0%, rgba(255, 255, 255, .58), transparent 44%),
        linear-gradient(180deg, rgba(246, 253, 255, .58), rgba(214, 226, 248, .42));
}

.hangman-page .keyboard {
    grid-template-columns: repeat(9, minmax(34px, 1fr));
    gap: 8px;
}

.hangman-page .key {
    min-height: 38px;
    touch-action: manipulation;
}

.hangman-page .footer {
    justify-content: center;
}

body.hangman-page > #help-modal.help-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    display: grid;
    width: 100vw;
    min-height: 100vh;
    min-height: 100dvh;
    place-items: center;
}

body.hangman-page > #help-modal.help-modal[hidden] {
    display: none;
}

@media (max-width: 760px) {
    body.hangman-page {
        padding: 10px 8px 10px;
    }

    .hangman-page .game {
        width: min(100%, 520px);
        padding: 0 12px 14px;
        border-radius: 18px;
    }

    .hangman-topbar {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-bottom: 12px;
        padding: 8px 0 10px;
    }

    .hangman-topbar h1 {
        text-align: center;
        font-size: clamp(1.45rem, 8.5vw, 2rem);
        letter-spacing: .07em;
    }

    .hangman-actions {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
        width: 100%;
    }

    .hangman-action-button {
        min-height: 36px;
        padding: 0 6px;
        font-size: clamp(.68rem, 3.2vw, .84rem);
        line-height: 1.04;
        text-align: center;
    }

    .hangman-page .board {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .hangman-page .hangman-svg {
        width: min(100%, 220px);
        max-height: 28svh;
    }

    .hangman-page .hint {
        font-size: .86rem;
    }

    .hangman-stats {
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .hangman-page .lives,
    .hangman-page #timer-text {
        min-height: 34px;
        padding: 6px 8px;
        font-size: .72rem;
        letter-spacing: .06em;
    }

    .hangman-page .word-wrapper {
        min-height: 64px;
        padding: 10px;
    }

    .hangman-page .keyboard {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 5px;
    }

    .hangman-page .key {
        min-height: 33px;
        padding: 0;
    }
}

@media (orientation: landscape) and (max-height: 520px) and (max-width: 1000px) {
    body.hangman-page {
        padding: 0 6px 8px;
    }

    .hangman-page .game {
        width: min(100%, 940px);
        min-height: calc(100svh - 8px);
        padding: 0 12px 9px;
    }

    .hangman-topbar {
        grid-template-columns: minmax(120px, .8fr) minmax(360px, 1fr);
        gap: 10px;
        margin-bottom: 8px;
        padding: 5px 0 6px;
    }

    .hangman-topbar h1 {
        font-size: clamp(1.1rem, 6svh, 1.65rem);
        text-align: left;
    }

    .hangman-actions {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }

    .hangman-action-button {
        min-height: 30px;
        padding: 0 7px;
        font-size: .68rem;
    }

    .hangman-page .settings-panel.open {
        max-height: calc(100svh - 62px);
        margin-bottom: 8px;
    }

    .hangman-page .board {
        grid-template-columns: minmax(180px, 30svw) minmax(420px, 1fr);
        gap: 9px;
    }

    .hangman-page .hangman-svg {
        width: min(100%, 210px);
        max-height: calc(100svh - 128px);
    }

    .hangman-page .hint {
        font-size: .76rem;
        line-height: 1.16;
    }

    .play-panel {
        gap: 6px;
    }

    .hangman-stats {
        grid-template-columns: 1fr;
        width: 142px;
        justify-self: end;
    }

    .hangman-page .lives,
    .hangman-page #timer-text {
        min-height: 29px;
        padding: 4px 8px;
        font-size: .68rem;
    }

    .hangman-page .word-wrapper {
        min-height: 62px;
        padding: 9px 10px;
    }

    .hangman-page .keyboard {
        margin-top: 0;
        grid-template-columns: repeat(13, minmax(0, 1fr));
        gap: 5px;
    }

    .hangman-page .key {
        min-height: 29px;
        font-size: .72rem;
    }

    .hangman-page .footer {
        margin-top: 5px;
    }
}
