/* /best3/best3.css */
/* votes/index.php の雰囲気（sky + brand-orange + 白カード + ふんわり影）に寄せた版 */

/* =========================
   Theme tokens (votes-like)
========================= */
:root {
    --brand-orange: #f39a38;
    --line-green: #06c755;
    --sky: #4fc3ff;

    --bg: #fafafa;
    --card: #fff;
    --line: #e6eef7;
    --text: #222;
    --muted: #666;

    --focus: #a6e6ff;
    --shadow: 0 2px 10px rgba(0, 0, 0, .06);
    --shadow-hover: 0 10px 28px rgba(0, 0, 0, .12);

    /* ===== Sheet / Best3 tokens (既存設計を維持) ===== */
    --sheet-bg: #fff8c9;
    --sheet-border: #f1d46a;
    --title-color: #111;
    --title-font: "Mochiy Pop One", system-ui, -apple-system, "Noto Sans JP", sans-serif;
    --item-font: "Zen Maru Gothic", system-ui, -apple-system, "Noto Sans JP", sans-serif;

    --plate-h: 112px;
    --item-h: 112px;
    --row-gap: 38px;

    --rank-left: 166px;
    --rank-font: 86px;
    --rank-skew: 7deg;
    --rank-shadow: 6px;

    --plate-w: 880px;

    --text-margin: 215px;
    --text-maxh: 88px;
    --text-maxw: 580px;
    --text-lineh: 1.12;

    /* text sizing helpers */
    --text-font: 34px;
    --text-font-1line: 60px;
    --text-y: -10px;

    /* radius */
    --r12: 12px;
    --r14: 14px;
    --r16: 16px;
}

/* =========================
   Base
========================= */
* {
    box-sizing: border-box
}

html,
body {
    overflow-x: hidden
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Noto Sans JP", sans-serif;
    background: var(--bg);
    color: var(--text);
    padding-bottom: 0;
}

a {
    color: inherit
}

img {
    max-width: 100%;
    height: auto
}

#dbg {
    display: none
}

/* =========================
   Layout
========================= */
.wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px;
}

/* votesっぽい上部 */
.topBar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 2px;
    margin-bottom: 6px;
}

.topBar .ttl {
    font-weight: 900;
    font-size: 18px;
    color: #0a78b1;
}

.actionBar {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 10px;
}

/* =========================
   Buttons (votes style)
========================= */
button {
    -webkit-tap-highlight-color: transparent;
}

.btn-cute,
button,
a.btn-cute {
    --pad-y: 12px;
    --pad-x: 18px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5em;
    border-radius: 9999px;
    font-weight: 900;
    letter-spacing: .02em;
    user-select: none;
    text-decoration: none;
    cursor: pointer;
    transition: transform .08s ease, box-shadow .15s ease, filter .2s ease, background .2s ease, border-color .2s ease;
    padding: var(--pad-y) var(--pad-x);
    line-height: 1;
    border: 2px solid transparent;
    appearance: none;
}

button:disabled {
    opacity: .55;
    cursor: not-allowed;
    pointer-events: none;
    filter: saturate(.7);
}

/* primary = sky */
#btnSave,
button:not(.secondary) {
    background: linear-gradient(180deg, var(--sky), #24b6ff);
    color: #fff;
    border-color: var(--sky);
    box-shadow: 0 6px 0 rgba(32, 165, 230, .45), 0 10px 18px rgba(79, 195, 255, .18);
}

#btnSave:hover,
button:not(.secondary):hover {
    filter: saturate(1.05) brightness(1.02);
}

#btnSave:active,
button:not(.secondary):active {
    transform: translateY(2px);
    box-shadow: 0 4px 0 rgba(32, 165, 230, .45), 0 6px 12px rgba(79, 195, 255, .14);
}

/* secondary = sky outline（votesの outline と同じ感じ） */
button.secondary,
.previewBtns button.secondary {
    background: #fff;
    color: var(--sky);
    border-color: var(--sky);
    box-shadow: 0 6px 0 #cfeeff, 0 10px 18px rgba(79, 195, 255, .18);
}

button.secondary:hover {
    background: #f7fcff;
}

button.secondary:active {
    transform: translateY(2px);
    box-shadow: 0 4px 0 #cfeeff, 0 6px 12px rgba(79, 195, 255, .14);
}

#btnOpenX {
    background: linear-gradient(180deg, var(--sky), #24b6ff);
    color: #fff;
    border-color: var(--sky);
    box-shadow: 0 6px 0 rgba(32, 165, 230, .45), 0 10px 18px rgba(79, 195, 255, .18);
}

#btnOpenX:hover {
    filter: saturate(1.05) brightness(1.02);
    background: linear-gradient(180deg, var(--sky), #24b6ff);
}

#btnOpenX:active {
    transform: translateY(2px);
    box-shadow: 0 4px 0 rgba(32, 165, 230, .45), 0 6px 12px rgba(79, 195, 255, .14);
}

/* focus */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

/* =========================
   Grid / Panels
========================= */
.grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    grid-template-areas: "input preview";
    gap: 12px;
    margin-top: 12px;
}

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r14);
    padding: 12px;
    min-width: 0;
    box-shadow: var(--shadow);
    transition: box-shadow .18s ease, transform .06s ease;
    will-change: transform;
}

@media(hover:hover) {
    .panel:hover {
        box-shadow: var(--shadow-hover);
        transform: translateY(-1px);
    }
}

@media(prefers-reduced-motion:reduce) {

    .panel,
    .panel:hover {
        transition: none;
        transform: none
    }
}

.panel.input {
    grid-area: input
}

.panel.preview {
    grid-area: preview
}

.panel h2 {
    margin: 0 0 10px;
    font-size: 13px;
    color: #0a78b1;
    font-weight: 900;
}

/* =========================
   Forms
========================= */
.row {
    display: grid;
    gap: 6px;
    margin-bottom: 10px
}

label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 800
}

input,
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 1.5px solid #cfeeff;
    border-radius: 12px;
    background: #fff;
    font-size: 16px;
    color: var(--text);
    box-shadow: none;
}

input:hover,
select:hover,
textarea:hover {
    background: #f7fcff
}

textarea {
    min-height: 62px;
    resize: vertical;
}

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

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

.hint {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5
}

/* swatches */
.bgSwatches {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.sw {
    width: 42px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid #cfeeff;
    cursor: pointer;
    outline: none;
    padding: 0;
    box-shadow: 0 1px 4px rgba(13, 27, 42, .05);
}

.sw.sel {
    box-shadow: 0 0 0 3px rgba(79, 195, 255, .28), 0 1px 4px rgba(13, 27, 42, .05);
    border-color: transparent;
}

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

.colorRow input[type="color"] {
    width: 54px;
    height: 40px;
    border: none;
    padding: 0;
    background: transparent;
}

/* details */
details {
    border: 1px solid #cfeeff;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 6px rgba(13, 27, 42, .06);
    margin-bottom: 10px;
}

summary {
    padding: 12px;
    cursor: pointer;
    font-weight: 900;
    color: #0a78b1;
    background: #f9fcff;
}

.dBody {
    padding: 10px 12px 12px;
    display: grid;
    gap: 10px;
}

/* rank boxes */
.rankBox {
    border: 1px solid #e6eef7;
    border-radius: 14px;
    padding: 10px;
    margin-bottom: 10px;
    background: #fff;
    box-shadow: 0 1px 6px rgba(13, 27, 42, .06);
}

.rankHead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.rankHead .rk {
    font-weight: 900;
    color: #0a78b1;
}

/* suggestion dropdown */
.sugWrap {
    position: relative
}

.sugList {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    background: #fff;
    border: 1px solid #cfeeff;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(13, 27, 42, .12);
    overflow: hidden;
    z-index: 50;
    display: none;
    max-height: 280px;
    overflow: auto;
}

.sugItem {
    padding: 12px;
    cursor: pointer;
    border-top: 1px solid #eef6ff;
    display: grid;
    gap: 4px;
}

.sugItem:first-child {
    border-top: none
}

.sugItem:hover {
    background: #f7fbff
}

.sugTop {
    font-weight: 900
}

.sugSub {
    font-size: 12px;
    color: #666
}

.sugTag {
    font-size: 11px;
    font-weight: 900;
    color: #0a78b1;
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid #cfeeff;
    background: #f7fcff;
    width: fit-content;
}

/* msg area */
#msgArea .msg {
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.5
}

.actionBar {
    flex-wrap: wrap;
    align-items: flex-start;
}

.actionMsg {
    width: 100%;
    margin-top: 10px;
}

@media (max-width:980px) {
    .actionMsg {
        display: none;
    }
}

.msg.ok {
    background: #effff2;
    border: 1px solid #c7f3cf;
    color: #1b6b2a;
    padding: 10px 12px;
    border-radius: 12px;
}

.msg.err {
    background: #fff1f1;
    border: 1px solid #ffd0d0;
    color: #7f2222;
    padding: 10px 12px;
    border-radius: 12px;
}

.msg.notice {
    background: #fff6ec;
    border: 1px solid #ffe2c7;
    color: #7a4a10;
    padding: 10px 12px;
    border-radius: 12px;
}

.msg a {
    display: inline-block;
    margin-top: 8px;
    font-weight: 900;
    color: #0a58ca;
    text-decoration: none;
}

/* preview lower buttons */
.previewBtns {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

/* =========================
   Preview stage (square)
========================= */
#previewArea {
    width: 100%;
    aspect-ratio: 1/1;
    display: grid;
    place-items: center;
    overflow: visible;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff, #f7fbff);
    border: 1px solid #cfeeff;
    box-shadow: 0 1px 10px rgba(13, 27, 42, .06) inset;
    position: relative;
}

/* stage that gets scaled by JS */
.sheetStage {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 1080px;
    height: 1080px;
    transform: translate(-50%, -50%) scale(1);
    transform-origin: center center;
    will-change: transform;
}

/* =========================
   Sheet (1080x1080)
========================= */
.sheet {
    position: relative;
    width: 1080px;
    height: 1080px;
    border-radius: 18px;
    overflow: hidden;
    background: var(--sheet-bg);
    border: 6px solid var(--sheet-border);
}

.sheetInner {
    position: absolute;
    inset: 0;
    padding: 30px;
}

/* Title */
.title {
    margin: 0;
    font-family: var(--title-font);
    font-weight: 900;
    color: var(--title-color);
    line-height: 1.15;
    font-size: 64px;
    letter-spacing: 1px;
    text-shadow: none;
}

.title .tline1,
.title .tline2 {
    text-shadow: 2px 2px 0 rgba(0, 0, 0, .08);
}

.title .tline {
    display: block;
    width: 100%;
}

.title .tline1 {
    text-align: left;
    padding-left: 100px;
    position: relative;
    top: 50px;
}

.title .tline2 {
    text-align: center;
    font-size: 100px;
    position: relative;
    top: 80px;
    margin-top: 0;
}

/* List */
.list {
    margin-top: 160px
}

.item {
    position: relative;
    height: var(--item-h);
}

.item+.item {
    margin-top: var(--row-gap)
}

/* Rank */
.rank {
    position: absolute;
    left: var(--rank-left);
    top: 40%;
    transform: translate(0, -50%);
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rank .rwrap {
    transform: skewX(var(--rank-skew));
    display: inline-block;
}

.rank .rmain {
    font-family: "Zen Maru Gothic", system-ui, -apple-system, "Noto Sans JP", sans-serif;
    font-weight: 900;
    font-size: var(--rank-font);
    line-height: 1;
    color: #6FC9F3;
    text-shadow:
        1px 0 0 #000, -1px 0 0 #000, 0 1px 0 #000, 0 -1px 0 #000,
        2px 2px 0 #000,
        var(--rank-shadow) var(--rank-shadow) 0 #000;
}

.rank.gold .rmain {
    color: #D4AF37
}

.rank.silver .rmain {
    color: #C0C0C0
}

.rank.bronze .rmain {
    color: #CD7F32
}

/* Plate */
.labelPlate {
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--plate-w);
    transform: translate(-50%, -50%);
    height: var(--plate-h);
    display: flex;
    align-items: center;
}

.plateImg {
    position: absolute;
    left: 50%;
    top: 50%;
    height: calc(var(--plate-h) * 1.18);
    transform: translate(-50%, -50%);
    z-index: 1;
    pointer-events: none;
    filter: drop-shadow(4px 5px 0 rgba(0, 0, 0, .24));
}

/* Text on plate */
.t {
    position: relative;
    z-index: 2;
    margin-left: var(--text-margin);
    font-family: var(--item-font);
    font-weight: 900;
    font-size: var(--text-font);
    max-width: var(--text-maxw);
    max-height: var(--text-maxh);
    line-height: var(--text-lineh);
    white-space: pre-line;
    overflow: hidden;
    word-break: break-word;
    transform: translateY(var(--text-y));
}

.t.oneLine {
    overflow: visible;
    max-height: none;
}

/* Kapi */
.kapi-wrap {
    position: absolute;
    right: -56px;
    bottom: -56px;
    width: 320px;
    height: 320px;
    overflow: visible;
    pointer-events: none;
    z-index: 5;
}

.kapi-img {
    width: 100%;
    height: 95%;
    object-fit: contain;
    transform-origin: 50% 50%;
    transform: rotate(-45deg) translate(0, 0);
    display: block;
    opacity: .92;
}


/* =========================
   Debug helper (optional)
========================= */
.debug-on #previewArea {
    outline: 3px solid rgba(0, 128, 255, .25)
}

.debug-on .sheet {
    outline: 3px solid rgba(255, 0, 128, .25)
}

/* =========================
   Responsive
========================= */
@media (max-width:980px) {
    body {
        padding-bottom: 76px
    }

    .wrap {
        padding: 10px
    }

    .grid {
        grid-template-columns: 1fr;
        grid-template-areas: "preview" "input";
    }

    .panel {
        padding: 12px
    }

    .actionBar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        padding: 10px 12px;
        background: rgba(249, 252, 255, .92);
        border-top: 1px solid #cfeeff;
        backdrop-filter: blur(8px);
        z-index: 999;
        justify-content: space-between;
        margin: 0;
    }

    .actionBar button {
        flex: 1;
        padding: 14px 12px;
        border-radius: 999px;
    }

    .previewBtns button {
        flex: 1;
    }
}

/* Small tweaks for very narrow screens */
@media (max-width:520px) {
    .topBar .ttl {
        font-size: 16px
    }

    input,
    select,
    textarea {
        font-size: 16px
    }
}

/* =========================
   setMsg() のリンク（投稿を見る / 編集する）をいい感じに
========================= */

.msgLinks {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

/* links 内の a をボタン化（votesのsecondary系） */
.msgLinks a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45em;

    padding: 10px 14px;
    border-radius: 9999px;

    font-weight: 900;
    font-size: 13px;
    letter-spacing: .02em;
    text-decoration: none;
    line-height: 1;

    color: var(--sky);
    background: #fff;
    border: 2px solid var(--sky);

    box-shadow: 0 6px 0 #cfeeff, 0 10px 18px rgba(79, 195, 255, .18);
    transition: transform .08s ease, box-shadow .15s ease, background .2s ease, filter .2s ease;
}

.msgLinks a:hover {
    background: #f7fcff;
}

.msgLinks a:active {
    transform: translateY(2px);
    box-shadow: 0 4px 0 #cfeeff, 0 6px 12px rgba(79, 195, 255, .14);
}

/* どっちがどっちか分かるように：1個目=投稿ページ、2個目=編集 */
.msgLinks a:first-child {
    background: linear-gradient(180deg, var(--sky), #24b6ff);
    color: #fff;
    border-color: var(--sky);
    box-shadow: 0 6px 0 rgba(32, 165, 230, .45), 0 10px 18px rgba(79, 195, 255, .18);
}

.msgLinks a:first-child:hover {
    filter: saturate(1.05) brightness(1.02);
}

.msgLinks a:first-child:active {
    box-shadow: 0 4px 0 rgba(32, 165, 230, .45), 0 6px 12px rgba(79, 195, 255, .14);
}

/* PCの actionMsg に出るときも気持ちよく */
#actionMsg .msg {
    margin-top: 0;
}

.shareBar {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.shareIcon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    border: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    cursor: pointer;
    transition: transform .15s ease-out, box-shadow .15s ease-out, filter .15s ease-out;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
}

.shareIcon:hover {
    transform: scale(1.06);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .14);
    filter: brightness(1.02);
}

.share-line {
    background: var(--line-green) !important;
}

.share-x {
    background: #000 !important;
}

.share-ig {
    background-image: linear-gradient(45deg, #405DE6, #5851DB, #833AB4, #C13584, #E1306C, #FD1D1D) !important;
}

.share-tt {
    background: #000 !important;
}

.share-fb {
    background: #1877f2 !important;
}

@media (max-width: 600px) {
    .shareIcon {
        width: 56px;
        height: 56px;
        border-radius: 16px;
        font-size: 24px;
    }
}