:root {
    --blue: #0064ad;
    --blue-dark: #004b85;
    --red: #d7141a;
    --gold: #e6a800;
    --green: #2a8f5a;
    --ink: #1d2a3a;
    --muted: #5f6b7a;
    --bg: #f4f7fb;
    --card: #ffffff;
    --line: #dfe5ee;
    --radius: 16px;
    --shadow: 0 10px 30px rgba(20, 40, 80, .10);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    background-image: radial-gradient(circle at 10% 0%, #ffffff 0, transparent 40%), radial-gradient(circle at 90% 10%, #e8f0fa 0, transparent 45%);
    color: var(--ink);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
main { flex: 1; }
.wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
a { color: var(--blue); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.inline { display: inline; }
.linklike { background: none; border: 0; padding: 0; color: var(--blue); text-decoration: underline; cursor: pointer; font: inherit; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.error { color: var(--red); font-weight: 600; margin: 8px 0 0; }
.hint { color: var(--muted); font-size: .9rem; margin: 6px 0 10px; }
.tag { display: inline-block; background: #e8f0fa; color: var(--blue-dark); border-radius: 999px; padding: 1px 10px; font-size: .8rem; font-weight: 600; vertical-align: middle; }
.tag:empty { display: none; }

/* Header */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 10px; padding-bottom: 10px; }
.logo img { display: block; height: 72px; width: auto; max-width: 100%; }
.logo-org img { height: 84px; }
@media (max-width: 600px) { .logo-org img { height: 60px; } .logo-partner img { height: 56px; } }

/* Hero */
.hero { text-align: center; padding: 36px 0 12px; }
.hero h1 { font-size: clamp(1.4rem, 3.2vw, 2.1rem); line-height: 1.25; color: var(--blue-dark); margin: 0 0 14px; }
.lead { font-size: 1.1rem; max-width: 760px; margin: 0 auto 10px; }
.howto { max-width: 760px; margin: 0 auto; color: var(--muted); }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 18px 0 8px; }
.counter { margin: 0; }
.segmented { display: inline-flex; background: #e6ecf5; border-radius: 999px; padding: 3px; }
.seg { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg.active { background: #fff; color: var(--blue-dark); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* Baubles */
.baubles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 26px 18px;
    padding: 10px 0 50px;
}
@media (max-width: 480px) { .baubles { grid-template-columns: repeat(2, 1fr); gap: 18px 10px; } }
.bauble {
    --c: var(--red);
    --c2: #ff6b6b;
    position: relative;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform .2s ease;
}
.bauble:hover:not(.is-claimed), .bauble:focus-visible:not(.is-claimed) { transform: translateY(-4px); }
.bauble:focus-visible .sphere { outline: 3px solid var(--blue); outline-offset: 4px; }
.b-red  { --c: #d7141a; --c2: #ff7a7a; }
.b-gold { --c: #d99a00; --c2: #ffd86b; }
.b-blue { --c: #0064ad; --c2: #6fb3ff; }
.b-green{ --c: #238a52; --c2: #7fd9a6; }

.bauble .string { width: 2px; height: 22px; background: linear-gradient(#9aa6b5, #c7cfdb); display: block; }
.bauble .cap {
    width: 30px; height: 18px; display: block;
    background: linear-gradient(90deg, #a68a2e, #f3dc8a 45%, #b8962f 80%, #8c7220);
    border-radius: 5px 5px 2px 2px;
    box-shadow: inset 0 -3px 0 rgba(0,0,0,.18);
    margin-bottom: -6px; z-index: 2; position: relative;
}
.bauble .sphere {
    position: relative;
    width: 150px; height: 150px;
    border-radius: 50%;
    display: block;
    overflow: hidden;
    background: #fff;
    border: 7px solid var(--c);
    box-shadow: 0 12px 24px rgba(20, 40, 80, .18), inset 0 0 0 3px rgba(255,255,255,.7), inset 0 -18px 28px rgba(0,0,0,.14);
    transition: filter .25s ease;
}
@media (max-width: 480px) { .bauble .sphere { width: 128px; height: 128px; } }
.bauble .sphere img {
    width: 100%; height: 100%; object-fit: contain; display: block; padding: 12px; background: #fff;
}
.bauble .placeholder { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 56px; }
.bauble .shine {
    position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
    background:
        radial-gradient(ellipse 36% 26% at 28% 18%, rgba(255,255,255,.95), rgba(255,255,255,0) 70%),
        radial-gradient(circle at 50% 50%, rgba(255,255,255,0) 58%, color-mix(in srgb, var(--c) 22%, transparent) 100%);
}
.bauble .number {
    position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
    background: var(--c); color: #fff; font-weight: 700; font-size: .78rem;
    padding: 2px 10px; border-radius: 999px; white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.bauble .label { margin-top: 12px; display: block; max-width: 180px; }
.bauble .title { display: block; font-weight: 700; line-height: 1.25; }
.bauble .from { display: block; font-size: .85rem; color: var(--muted); margin-top: 2px; }

.bauble .claimed-overlay {
    position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
    padding: 18px; text-align: center; font-weight: 700; font-size: .85rem; line-height: 1.3;
    background: rgba(240, 242, 245, .82); color: #4a5563; border-radius: 50%;
}
.bauble.is-claimed { cursor: default; }
.bauble.is-claimed .sphere { filter: grayscale(1); border-color: #b9c0ca; box-shadow: 0 6px 14px rgba(20,40,80,.08), inset 0 -18px 28px rgba(0,0,0,.08); }
.bauble.is-claimed .sphere img { opacity: .45; }
.bauble.is-claimed .claimed-overlay { display: flex; }
.bauble.is-claimed .number { background: #8d97a5; }
.bauble.is-claimed .label { opacity: .55; }
.bauble.is-claimed .cap { filter: grayscale(1); opacity: .6; }
.bauble.is-hidden { display: none; }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 40px 0; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 18px; border-radius: 10px; border: 2px solid transparent;
    font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; line-height: 1.2;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-primary[disabled] { opacity: .6; cursor: wait; }
.btn-ghost { background: #fff; color: var(--blue-dark); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--blue); }
.btn-big { width: 100%; padding: 14px 18px; font-size: 1.05rem; }

/* Modal */
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 25, 45, .55); }
.modal-card {
    position: relative; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
    width: 100%; max-width: 820px; max-height: calc(100vh - 32px); overflow: auto;
}
.modal-close {
    position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border-radius: 50%;
    border: 0; background: #eef2f7; font-size: 26px; line-height: 1; cursor: pointer; color: var(--ink); z-index: 2;
}
.modal-body { display: grid; grid-template-columns: 300px 1fr; gap: 24px; padding: 24px; }
@media (max-width: 680px) { .modal-body { grid-template-columns: 1fr; padding: 18px; } }
.m-image { background: #fff; border: 1px solid var(--line); border-radius: 12px; min-height: 240px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.m-image img { max-width: 100%; max-height: 360px; object-fit: contain; display: block; }
.m-image img[src=""] { display: none; }
.placeholder-big { font-size: 90px; }
.m-number { margin: 4px 0 0; color: var(--muted); font-weight: 600; }
.m-text h2 { margin: 2px 0 10px; font-size: 1.5rem; line-height: 1.2; color: var(--blue-dark); }
.m-from { margin: 0 0 10px; }
.m-description { white-space: pre-line; margin: 0 0 10px; }
.m-description:empty, .m-price:empty { display: none; }
.m-price { font-weight: 700; margin: 0 0 10px; }
#m-link-wrap { margin: 6px 0 16px; }
#m-link-wrap[hidden] { display: none; }
.claim-form { margin-top: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f8fafd; }
.claim-form label { display: block; font-weight: 700; margin-bottom: 4px; }
.claim-form input { width: 100%; padding: 10px 12px; border: 1px solid #b9c3d0; border-radius: 8px; font: inherit; }
.notice { padding: 14px 16px; border-radius: 12px; margin-top: 8px; }
.notice-grey { background: #f0f2f5; color: #4a5563; }
.notice-green { background: #e6f6ec; color: #1d6b3f; }

/* Gate */
.gate-page main { display: flex; align-items: center; justify-content: center; padding: 40px 0; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px; }
.gate { max-width: 560px; margin: 0 auto; text-align: center; }
.gate h1 { font-size: 1.4rem; color: var(--blue-dark); line-height: 1.3; }
.gate-form { margin-top: 20px; text-align: left; }
.gate-form label { font-weight: 700; display: block; margin-bottom: 6px; }
.gate-form input { flex: 1; min-width: 180px; padding: 12px; border: 1px solid #b9c3d0; border-radius: 10px; font: inherit; font-size: 1.05rem; }
.gate-ornament { display: flex; justify-content: center; gap: 12px; margin-bottom: 10px; }
.mini-bauble { width: 26px; height: 26px; border-radius: 50%; display: inline-block; box-shadow: inset -4px -5px 8px rgba(0,0,0,.18), inset 4px 4px 8px rgba(255,255,255,.5); }
.mini-bauble.b-red { background: var(--red); } .mini-bauble.b-gold { background: var(--gold); } .mini-bauble.b-blue { background: var(--blue); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: #fff; padding: 20px 0; text-align: center; margin-top: 20px; }
.site-footer p { margin: 4px 0; }
.site-footer .footer-links { margin: 4px 0; }
.site-footer .footer-links a, .site-footer .footer-links .linklike { color: var(--muted); text-decoration: none; }
.site-footer .footer-links a:hover, .site-footer .footer-links .linklike:hover { color: var(--blue); text-decoration: underline; }
.powered-by { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; padding: 6px 12px; border-radius: 999px; text-decoration: none; opacity: .85; transition: opacity .15s; }
.powered-by:hover { opacity: 1; background: var(--bg); }
.powered-by img { height: 18px; width: auto; display: block; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow); z-index: 60; }
