/* Game screen only. Shared rules are in styles.css. */

#start-game-container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    margin-top: 10px;
    left: 0;
    height: 70vh;
    width: 100vw;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.1s ease, visibility 0.1s ease;
}

#start-game-container.active {
    visibility: visible;
    opacity: 1;
}

#start-game-btn {
    background-color: var(--rat-blue);
    color: #fff;
    font-size: 1.1rem;
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#start-game-btn:hover {
    background-color: var(--rat-gold);
    color: #000;
}

.top-bar {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background-color: transparent;
    padding: 10px;
    font-size: 1.2rem;
    font-weight: bold;
}

/* The icon cluster never wraps. Only two icons show at a time, so they keep
   the original generous 12px padding — comfortable tap targets. */
.top-bar > div {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Covers the icon buttons and the logo link, which is an <a class="btn">. */
.top-bar button,
.top-bar .btn {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    color: #757575;
    padding: 12px;
    box-shadow: none;
}

.top-bar button:hover,
.top-bar .btn:hover {
    background: transparent;
    color: var(--rat-blue);
}

.top-bar .home-button {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    min-width: 0;
}

/* The title logo gives way before the icons do. */
.top-bar .home-button img {
    height: 35px;
    width: auto;
    max-width: 100%;
}

.puzzle-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    padding: 5px;
    max-width: 600px;
    width: 100%;
    visibility: hidden;
}

.puzzle-header {
    font-size: 1rem;
    margin-top: 20px;
    color: var(--rat-teal);
}

#puzzle-prompt {
    font-size: 2.1rem;
    color: #666;
    margin: 10px 0;
    transition: color 0.2s ease;
}

#puzzle-prompt.is-wrong {
    color: #d62828;
}

#timer.is-solved {
    color: var(--rat-green) !important;
}

input#user-answer {
    margin: 10px auto;
    border: 2px solid #ccc;
    border-radius: 25px;
    max-width: 300px;
    font-size: 1.2rem;
    padding: 10px 15px;
}

.btn-container {
    margin: 10px;
}

/* ----------------------------------------------------------------- attempts */

#attempt-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--rat-surface);
    border-bottom: 1px solid var(--rat-border);
    margin-top: 10px;
}

#recent-words {
    flex-grow: 1;
    text-align: left;
    margin-left: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
    color: #495057;
}

#attempt-dropdown {
    background-color: #fff;
    border: 1px solid var(--rat-border);
    position: absolute;
    width: 100%;
    z-index: 10;
}

#attempt-dropdown-btn {
    background-color: transparent;
    color: grey;
    border: none;
    box-shadow: none;
}

#attempt-dropdown-btn:hover {
    background-color: transparent;
    color: var(--rat-blue);
}

#attempt-dropdown-btn:focus {
    box-shadow: none;
}

#all-words-list li {
    padding: 5px 0;
    border-bottom: 1px solid var(--rat-border);
}

#all-words-list li:last-child {
    border-bottom: none;
}

/* --------------------------------------------------------------------- hint */

.hint-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 50px;
    width: 100%;
    position: relative;
    margin-bottom: 10px;
}

#hint-btn,
#puzzle-hint {
    max-width: 250px;
    height: 100%;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

#hint-btn {
    max-width: 150px;
    display: none;
    position: absolute;
    width: 100%;
    overflow: hidden;
}

#hint-btn.show {
    background-color: var(--rat-gold);
    color: #000;
    display: flex;
}

#hint-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background-color: rgba(0, 0, 0, 0.2);
}

#puzzle-hint {
    display: none;
    flex: 1;
    font-size: 1rem;
    color: var(--rat-blue);
    margin: 10px;
}

/* The label sits above the hold-progress fill. */
#hint-label {
    position: relative;
    z-index: 1;
}

/* Shown above the pill while it is being held, so a thumb can't cover it. */
.hint-warning {
    position: absolute;
    /* Sits in the middle of the gap between the attempts bar and the pill. */
    bottom: calc(100% + 12px);
    left: 0;
    right: 0;
    text-align: center;
    color: #d62828;
    font-weight: 700;
    font-size: 0.95rem;
    pointer-events: none;
    animation: hint-pulse 0.8s ease-in-out infinite;
}

@keyframes hint-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(1.06); }
}

#puzzle-hint.show {
    display: flex;
}

/* --------------------------------------------------------------- completion */

.completion-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 470px;
    text-align: center;
}

.completion-card {
    margin-top: 20px;
    position: relative;
    border: 2px solid #ccc;
    border-radius: 15px;
    padding: 20px;
    background-color: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.completion-card h1 {
    font-size: 1.8rem;
    margin: 10px 0;
    color: #333;
}

.completion-card h2 {
    font-size: 1.4rem;
    margin-bottom: 10px;
    color: var(--rat-blue);
}

.completion-card p {
    font-size: 1rem;
    margin: 5px 0;
    color: #666;
}

.completion-card .btn {
    margin-top: 10px;
    margin-bottom: 20px;
    background-color: var(--rat-green);
    color: #fff;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    padding: 10px 20px;
    z-index: 1;
}

.completion-card .btn:hover {
    background-color: var(--rat-blue-dark);
    color: #fff;
}

/* -------------------------------------------------------------------- clock */

.clock-container {
    position: relative;
    width: 19px;
    height: 19px;
    border: 1px solid #757575;
    border-radius: 50%;
    display: inline-block;
    background: transparent;
}

.clock-container .hour-hand,
.clock-container .minute-hand {
    position: absolute;
    width: 1px;
    background: #757575;
    left: 50%;
    bottom: 50%;
    transform-origin: bottom center;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    animation-play-state: paused;
}

.clock-container .hour-hand {
    height: 25%;
    animation-name: spin-hour;
    animation-duration: 12s;
}

.clock-container .minute-hand {
    height: 35%;
    animation-name: spin-minute;
    animation-duration: 4s;
}

/* The hands only turn while a game is actually running. */
.clock-container.is-running .hour-hand,
.clock-container.is-running .minute-hand {
    animation-play-state: running;
}

@keyframes spin-hour {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes spin-minute {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    #puzzle-prompt {
        font-size: 1.7rem;
    }
}
