@font-face {
    font-family: "Nudge Black";
    src: url("../fonts/Nudge-Black.otf") format("opentype");
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: #030267;
    color: #fff;
    font-family: "Source Sans 3", "Segoe UI", sans-serif;
}

.rank-app {
    max-width: 420px;
    margin: 0 auto;
    padding: 16px 16px 32px;
}

.rank-header h1 {
    margin: 4px 0 12px;
    font-size: 1.6rem;
}

.rank-kicker {
    margin: 0;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: #d1b67b;
}

.rank-photo-tip {
    margin: 0 0 12px;
    padding: 14px 16px;
    border-radius: 16px;
    background: #d1b67b;
    color: #040369;
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.35;
}

#rank-canvas {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 18px;
    background: #040369;
}

.rank-form {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.rank-form label {
    display: grid;
    gap: 4px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
}

.rank-form input[type="text"],
.rank-form input:not([type="checkbox"]) {
    border: 0;
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    color: #030267;
}

.rank-check {
    display: flex !important;
    align-items: center;
    gap: 8px;
    color: #fff;
}

.rank-photo-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin-top: 12px;
}

.rank-presets {
    display: flex;
    flex: 0 1 auto;
    gap: 8px;
    min-width: 0;
    overflow-x: auto;
}

.rank-preset {
    flex: 0 0 96px;
    width: 96px;
    height: 128px;
    padding: 0;
    border: 3px solid transparent;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 0.65rem;
    cursor: pointer;
}

.rank-preset img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rank-preset.is-selected {
    border-color: #d1b67b;
}

.rank-photo-btn {
    display: flex;
    flex: 0 0 148px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 0;
    padding: 12px 10px;
    border: 3px solid transparent;
    border-radius: 12px;
    background: #d1b67b;
    color: #040369;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    cursor: pointer;
}

.rank-photo-btn.is-selected {
    border-color: #fff;
    box-shadow: 0 0 0 3px #d1b67b;
}

.rank-photo-btn strong {
    font-size: 1.35rem;
    letter-spacing: 0.03em;
    text-decoration: underline;
}

.rank-file-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.photo-source {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 16, 36, 0.55);
}

.photo-source[hidden] {
    display: none;
}

.photo-source-card {
    width: min(100%, 22rem);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.1rem 1rem 1rem;
    border-radius: 16px;
    background: #fff;
    color: #040369;
    box-shadow: 0 12px 40px rgba(0, 16, 36, 0.28);
}

.photo-source-card h3 {
    margin: 0;
    font-size: 1.15rem;
}

.photo-source-hint {
    margin: 0;
    color: #4b5563;
    font-size: 0.9rem;
    line-height: 1.4;
}

.photo-source-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
}

.photo-source-btn,
.photo-source-close {
    appearance: none;
    font: inherit;
    border-radius: 12px;
    padding: 0.8rem 0.7rem;
    cursor: pointer;
}

.photo-source-btn {
    border: 0;
    background: #d1b67b;
    color: #040369;
    font-weight: 700;
}

.photo-source-close {
    border: 1px solid #d6d3c4;
    background: transparent;
    color: #040369;
}

body.photo-source-open {
    overflow: hidden;
}

.rank-caption {
    white-space: pre-wrap;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px;
    font-size: 0.92rem;
    line-height: 1.4;
}

.rank-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.rank-btn {
    border: 0;
    border-radius: 999px;
    padding: 12px 10px;
    font: inherit;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    cursor: pointer;
}

.rank-btn-primary {
    grid-column: 1 / -1;
    background: #d1b67b;
    color: #040369;
}

.rank-toast {
    margin: 10px 0 0;
    color: #d1b67b;
    font-size: 0.9rem;
}

.is-embedded .rank-app {
    padding-top: 8px;
}
