/* ============================================================
   WordPlay PWA — Styles
   ============================================================ */

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Georgia', 'Times New Roman', serif;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

#app {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ---- HEADER ---- */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: max(8px, env(safe-area-inset-top)) 14px 6px;
    flex-shrink: 0;
}

.header-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 5px 12px;
    font-size: 15px;
    cursor: pointer;
    font-family: inherit;
}

.header-center {
    text-align: center;
    line-height: 1.3;
}

.header-pack {
    font-size: 10px;
    opacity: 0.5;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.header-level {
    font-size: 18px;
    font-weight: 700;
}

.coin-display {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    cursor: default;
}

/* ---- GRID AREA ---- */
.grid-area {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    min-height: 0;
    overflow: hidden;
    gap: 10px;
}

.grid-container {
    display: grid;
}

.grid-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    transition: background 0.3s;
}

.grid-cell.revealed {
    animation: wordReveal 0.35s ease;
}

.grid-cell.flash {
    animation: cellGlow 0.6s ease;
}

/* ---- UNPLACED WORDS ---- */
.unplaced-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    padding: 0 8px;
}

.unplaced-word {
    display: flex;
    gap: 1px;
    align-items: center;
}

.unplaced-cell {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7px;
    font-weight: 700;
    line-height: 1;
    color: transparent;
}

.unplaced-cell.found {
    animation: wordReveal 0.35s ease;
}

/* ---- WORD COUNT ---- */
.word-count {
    text-align: center;
    padding: 2px 16px 0;
    font-size: 13px;
    letter-spacing: 0.5px;
}

/* ---- TOAST ---- */
.toast {
    position: absolute;
    left: 50%;
    top: 42%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.85);
    padding: 10px 22px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    z-index: 100;
    pointer-events: none;
    animation: toastAnim 1.5s ease-out forwards;
}

.toast.fast {
    animation: toastFast 0.8s ease-out forwards;
}

/* ---- LETTER WHEEL ---- */
.wheel-section {
    flex-shrink: 0;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.current-word {
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 4px;
    text-transform: uppercase;
    font-family: 'Georgia', serif;
}

.wheel-area {
    position: relative;
    touch-action: none;
}

.wheel-letter {
    position: absolute;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    text-transform: uppercase;
    font-family: 'Georgia', serif;
    pointer-events: none;
    transition: transform 0.12s, background 0.12s, color 0.12s;
}

.wheel-letter.active {
    transform: scale(1.18);
}

/* ---- ACTION BUTTONS ---- */
.action-bar {
    display: flex;
    gap: 12px;
}

.action-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 7px 16px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 5px;
}

.action-btn.disabled {
    background: rgba(255,255,255,0.03);
    cursor: default;
}

.action-btn .cost {
    font-size: 11px;
    opacity: 0.6;
}

/* ---- COMPLETE MODAL ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.modal-box {
    background: rgba(20,15,30,0.96);
    border-radius: 22px;
    padding: 28px 24px;
    text-align: center;
    max-width: 300px;
    width: 100%;
    animation: pop 0.4s ease;
}

.modal-emoji {
    font-size: 52px;
}

.modal-title {
    margin: 8px 0 4px;
    font-size: 22px;
    font-family: Georgia, serif;
}

.modal-subtitle {
    margin: 0 0 4px;
    font-size: 12px;
    opacity: 0.5;
}

.modal-coins {
    margin: 8px 0 20px;
    font-size: 15px;
}

.modal-next-btn {
    border: none;
    border-radius: 14px;
    padding: 13px 0;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    font-family: Georgia, serif;
    color: #000;
}

/* ---- LEVEL MENU ---- */
.menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 300;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

.menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: max(12px, env(safe-area-inset-top)) 16px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.menu-title {
    margin: 0;
    font-size: 20px;
    font-family: Georgia, serif;
}

.menu-close {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    border-radius: 10px;
    padding: 5px 14px;
    font-size: 18px;
    cursor: pointer;
}

.menu-scroll {
    flex: 1;
    overflow: auto;
    padding: 12px 16px;
    -webkit-overflow-scrolling: touch;
}

.menu-pack-label {
    font-size: 11px;
    opacity: 0.4;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 6px;
    font-family: inherit;
}

.menu-pack-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
}

.menu-level-btn {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    cursor: pointer;
}

.menu-level-btn.locked {
    cursor: default;
}

.menu-current {
    text-align: center;
    padding: 20px 0;
    margin-bottom: 10px;
}

.menu-current-label {
    font-size: 11px;
    opacity: 0.4;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.menu-current-num {
    font-size: 48px;
    font-weight: 800;
    line-height: 1.1;
}

.menu-current-info {
    font-size: 14px;
    opacity: 0.6;
    margin-top: 4px;
}

.menu-current-progress {
    font-size: 12px;
    opacity: 0.35;
    margin-top: 4px;
}

.menu-nav-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.menu-nav-btn {
    flex: 1;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 10px 8px;
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.menu-nav-btn:active {
    background: rgba(255,255,255,0.1);
}

.menu-stat {
    font-size: 14px;
    padding: 6px 0;
    opacity: 0.7;
}

.menu-setting {
    margin: 20px 0 10px;
    padding: 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
}

.menu-setting-label {
    font-size: 12px;
    opacity: 0.6;
    letter-spacing: 1px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 8px;
}

.menu-setting-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.menu-setting-input {
    flex: 1;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 16px;
    color: #fff;
    font-family: inherit;
    outline: none;
}

.menu-setting-input:focus {
    border-color: rgba(255,255,255,0.3);
}

.menu-setting-btn {
    border: none;
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}

.menu-setting-hint {
    font-size: 11px;
    opacity: 0.35;
    margin-top: 6px;
}

.menu-setting {
    margin: 20px 0 10px;
    padding: 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
}

.menu-setting-label {
    font-size: 12px;
    opacity: 0.6;
    letter-spacing: 1px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 8px;
}

.menu-setting-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.menu-setting-input {
    flex: 1;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 16px;
    color: #fff;
    font-family: inherit;
    outline: none;
}

.menu-setting-input:focus {
    border-color: rgba(255,255,255,0.3);
}

.menu-setting-btn {
    border: none;
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}

.menu-setting-hint {
    font-size: 11px;
    opacity: 0.35;
    margin-top: 6px;
}

.menu-footer {
    padding: 20px 0;
    text-align: center;
    font-size: 12px;
    opacity: 0.3;
}

/* ---- ANIMATIONS ---- */
@keyframes toastAnim {
    0% { opacity: 1; transform: translate(-50%, -50%); }
    70% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -70%); }
}

@keyframes toastFast {
    0% { opacity: 1; transform: translate(-50%, -50%); }
    50% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -65%); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

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

@keyframes slideUp {
    0% { transform: translateY(100%); }
    100% { transform: translateY(0); }
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

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

@keyframes cellGlow {
    0% { box-shadow: 0 0 0 0 rgba(255,255,255,0.4); }
    100% { box-shadow: 0 0 12px 2px rgba(255,255,255,0); }
}
