* {
    box-sizing: border-box;
}

body {
    font-family: "Inter", "IBM Plex Sans JP", "Helvetica Neue", Arial, "Noto Sans JP", sans-serif;
    background: #ffffff;
    color: #2a3356;
    min-height: 100vh;
    margin: 0;
}

:root {
    --cs-ink: #2a3356;
    --cs-blue: #6283f1;
    --cs-blue-hover: #99b1ff;
    --cs-blue-link: #4169ee;
    --cs-blue-soft: #eff3fe;
    --cs-border: #d5dae8;
    --cs-border-light: #ebeff7;
    --cs-label: #7d88ae;
    --cs-cyan: #69dcec;
    --cs-muted: #647090;
    --cs-line: rgba(98, 131, 241, 0.18);
    --cs-soft: #f6f8ff;
}

/* ---------- gate layout ---------- */
.cs-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 60px;
    max-width: 700px;
    margin: 0 auto;
    padding: 64px 20px 140px;
}

.cs-logo {
    width: 100%;
    max-width: 311px;
    display: flex;
    justify-content: center;
}

.cs-logo img {
    width: 100%;
    height: auto;
    display: block;
}

.cs-text {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    text-align: center;
}

.cs-text p {
    margin: 0;
    color: var(--cs-ink);
    font-family: "Inter", "IBM Plex Sans JP", sans-serif;
}

.cs-text p:first-child {
    font-size: 17px;
    font-weight: 500;
    line-height: 1.59;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.cs-text p:last-child {
    font-size: 16px;
    font-weight: 400;
    line-height: 1.56;
    letter-spacing: 0.02em;
}

/* ---------- autosave tooltip ---------- */
.autosave-wrap {
    position: relative;
    display: inline-block;
    vertical-align: baseline;
}

.autosave-term {
    display: inline-block;
    color: var(--cs-blue);
    font-weight: 400;
    cursor: help;
    outline: none;
    background: linear-gradient(90deg, var(--cs-blue) 0%, var(--cs-blue) 34%, var(--cs-cyan) 48%, var(--cs-blue-hover) 56%, var(--cs-blue) 70%, var(--cs-blue) 100%);
    background-size: 240% 100%;
    background-position: 100% 50%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: cs-autosaveTextFlow 10s linear 1.8s infinite;
}

.autosave-term:focus-visible {
    border-radius: 6px;
    box-shadow: 0 0 0 3px rgba(98, 131, 241, 0.18);
}

.autosave-popover {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 18px);
    width: 390px;
    max-width: min(390px, calc(100vw - 40px));
    padding: 24px;
    border-radius: 18px;
    background: #fff;
    box-shadow:
        0 20px 54px rgba(31, 42, 78, 0.15),
        0 3px 12px rgba(31, 42, 78, 0.08);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-50%) translateY(8px);
    transition: opacity 0.18s ease, visibility 0.18s ease, transform 0.18s ease;
    z-index: 10;
    text-align: left;
}

.autosave-popover::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -12px;
    width: 0;
    height: 0;
    transform: translateX(-50%);
    border-width: 13px 10px 0 10px;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
}

.autosave-wrap:hover .autosave-popover,
.autosave-wrap:focus-within .autosave-popover {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.popover-title {
    display: block;
    margin: 0 0 14px;
    color: var(--cs-ink);
    font-size: 18px;
    line-height: 1.35;
    font-weight: 400;
    text-align: center;
}

.popover-summary {
    display: block;
    margin: 0 0 18px;
    color: var(--cs-ink);
    font-size: 13px;
    line-height: 1.65;
    font-weight: 400;
}

.save-points {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.save-point {
    display: grid;
    grid-template-columns: 38px 1fr;
    gap: 14px;
    align-items: center;
    min-height: 74px;
    padding: 14px 16px;
    border: 1px solid var(--cs-line);
    border-radius: 10px;
    background: var(--cs-soft);
}

.save-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #fff;
    color: var(--cs-blue);
    box-shadow: inset 0 0 0 1px rgba(98, 131, 241, 0.16);
}

.save-icon svg {
    width: 21px;
    height: 21px;
    display: block;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.save-text {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.save-point strong {
    display: block;
    color: var(--cs-ink);
    font-size: 13px;
    line-height: 1.45;
    font-weight: 600;
}

.save-text span {
    display: block;
    color: var(--cs-ink);
    font-size: 13px;
    line-height: 1.55;
    font-weight: 400;
}

@keyframes cs-autosaveTextFlow {
    0% {
        background-position: 100% 50%;
    }

    20%,
    100% {
        background-position: 0% 50%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .autosave-term {
        animation: none;
    }
}

@media (max-width: 720px) {
    .autosave-popover {
        width: min(340px, calc(100vw - 36px));
    }
}

/* ---------- file box ---------- */
.cs-file-box {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
}

.cs-btn-primary,
.cs-btn-secondary {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border-radius: 8px;
    font-family: "Inter", sans-serif;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.cs-btn-primary {
    height: 100px;
    background: var(--cs-blue);
    border: none;
    color: #fff;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.06em;
}

.cs-btn-primary:hover {
    background: var(--cs-blue-hover);
}

.cs-btn-primary svg {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
}

.cs-btn-secondary {
    background: #fff;
    border: 1px solid var(--cs-blue);
    color: var(--cs-blue-link);
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.cs-btn-secondary:hover {
    background: var(--cs-blue-soft);
}

.cs-btn-secondary svg {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
}

.cs-btn-primary:disabled,
.cs-btn-secondary:disabled {
    opacity: 0.6;
    cursor: default;
}

.cs-file-open-box {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
}

/* ---------- recent files table ---------- */
.cs-recent {
    width: 100%;
    display: none;
}

.cs-recent-header {
    padding: 6px 12px;
    font-family: "Inter", sans-serif;
    font-size: 16px;
    color: var(--cs-ink);
}

.cs-recent-colheader,
.cs-recent-row {
    display: grid;
    grid-template-columns: 36px 1fr 104px 68px 36px;
    column-gap: 8px;
    align-items: center;
}

.cs-recent-colheader>span {
    padding: 6px 12px;
    font-family: "Inter", sans-serif;
    font-size: 14px;
    color: var(--cs-label);
    white-space: nowrap;
}

.cs-col-filename {
    grid-column: 1 / 3;
    padding-left: 12px;
}

.cs-recent-list {
    border-top: 1px solid var(--cs-border-light);
}

.cs-recent-row {
    position: relative;
    border-top: 1px solid var(--cs-border-light);
    cursor: pointer;
    color: var(--cs-ink);
}

.cs-recent-list .cs-recent-row:first-child {
    border-top: none;
}

.cs-recent-row:hover,
.cs-recent-row.cs-menu-open {
    background: var(--cs-blue-soft);
    color: var(--cs-blue-link);
}

.cs-row-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 2px 6px 12px;
}

.cs-row-icon svg {
    width: 20px;
    height: 20px;
}

.cs-row-name {
    padding: 6px 12px;
    padding-left: 0;
    margin-left: -6px;
    font-family: "Inter", sans-serif;
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cs-row-date,
.cs-row-count {
    padding: 6px 12px;
    font-family: "Inter", sans-serif;
    font-size: 16px;
    white-space: nowrap;
}

.cs-row-menu {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.cs-row-menu-btn {
    background: none;
    border: none;
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: inherit;
    border-radius: 6px;
}

.cs-row-menu-btn:hover {
    background: rgba(98, 131, 241, 0.16);
}

.cs-row-menu-btn svg {
    width: 2px;
    height: 10px;
}

.cs-row-menu-popover {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 5;
    min-width: 180px;
    background: #fff;
    border: 1px solid var(--cs-border);
    border-radius: 8px;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.cs-row-menu.is-open .cs-row-menu-popover {
    display: block;
}

.cs-row-menu-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: #fff;
    border: none;
    text-align: left;
    font-family: "Inter", sans-serif;
    font-size: 13px;
    color: var(--cs-ink);
    cursor: pointer;
}

.cs-row-menu-item:hover {
    background: var(--cs-blue-soft);
    color: var(--cs-blue-link);
}

/* ---------- demo button ---------- */
.cs-demo-btn {
    display: flex;
    align-items: stretch;
    width: 220px;
    max-width: 100%;
    height: 36px;
    background: #ffffff;
    border: 1px solid var(--cs-blue);
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    cursor: pointer;
}

.cs-demo-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    background: var(--cs-blue);
    color: #fff;
    font-family: "Inter", sans-serif;
    font-size: 16px;
    font-weight: 400;
    letter-spacing: 0.02em;
}

.cs-demo-label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    font-family: "Inter", sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: var(--cs-blue-link);
    white-space: nowrap;
}

.cs-demo-btn:hover .cs-demo-badge {
    background: var(--cs-blue-hover);
}

.cs-demo-btn:hover .cs-demo-label {
    background: var(--cs-blue-soft);
}

.cs-demo-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

#start-loading {
    display: none;
    width: 28px;
    height: 28px;
    border: 3px solid #eee;
    border-top-color: var(--cs-blue);
    border-radius: 50%;
    animation: start-loading-spin 0.8s linear infinite;
}

@keyframes start-loading-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 560px) {
    .cs-recent-colheader,
    .cs-recent-row {
        grid-template-columns: 36px 1fr 68px 36px;
    }

    .cs-row-date {
        display: none;
    }
}

/* ---------- floating guide bubble ---------- */
.guide-widget {
    position: fixed;
    right: 16px;
    bottom: 8px;
    width: 300px;
    max-width: calc(100vw - 24px);
    height: 200px;
    pointer-events: none;
    z-index: 40;
}

.guide-trigger {
    position: absolute;
    right: 38px;
    bottom: 22px;
    width: 63px;
    height: auto;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    pointer-events: auto;
    z-index: 3;
}

.guide-trigger img {
    width: 100%;
    height: auto;
    display: block;
}

.guide-bubble {
    position: absolute;
    right: 0;
    bottom: 110px;
    isolation: isolate;
    width: 240px;
    min-height: 64px;
    padding: 20px;
    border-radius: 28px;
    background: #fff;
    pointer-events: auto;
    box-shadow:
        0 20px 54px rgba(31, 42, 78, 0.15),
        0 3px 12px rgba(31, 42, 78, 0.08);
    opacity: 1;
    animation: cs-bubbleIntro 0.42s linear 0.72s backwards;
    transition:
        width 0.32s cubic-bezier(0.16, 1, 0.3, 1),
        min-height 0.32s cubic-bezier(0.16, 1, 0.3, 1),
        padding 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: width, min-height, padding, opacity;
}

.guide-bubble:hover,
.guide-widget.is-guide-open .guide-bubble,
.guide-widget:focus-within .guide-bubble {
    width: 360px;
    max-width: calc(100vw - 24px);
}

.guide-widget.is-dismissed .guide-bubble {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    animation: none;
}

.guide-widget.is-dismissed.is-guide-open .guide-bubble,
.guide-widget.is-dismissed:focus-within .guide-bubble {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.guide-bubble::before {
    content: "";
    position: absolute;
    inset: -4px;
    z-index: -1;
    padding: 4px;
    border-radius: 32px;
    background:
        radial-gradient(circle at 88% 50%, rgba(105, 220, 236, 0.95) 0 9%, rgba(98, 131, 241, 0.86) 18%, transparent 36%),
        linear-gradient(110deg, transparent 0 42%, var(--cs-cyan) 54%, var(--cs-blue) 66%, transparent 82% 100%);
    background-size: 180% 180%, 260% 100%;
    background-position: 112% 50%, 128% 50%;
    opacity: 0;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    animation: cs-aiModeGlow 12s ease-in-out 7.2s infinite;
    pointer-events: none;
}

.guide-widget.is-dismissed .guide-bubble::before {
    animation: none;
    opacity: 0;
}

.guide-bubble::after {
    content: "";
    position: absolute;
    right: 54px;
    bottom: -17px;
    width: 0;
    height: 0;
    border-width: 18px 11px 0 11px;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
    opacity: 0;
    animation: cs-bubbleTailIntro 0.14s linear 1.06s forwards;
}

.guide-bubble-title {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    color: var(--cs-ink);
    font-family: "Inter", sans-serif;
    font-size: 18px;
    font-weight: 500;
    line-height: 1.35;
    text-align: center;
    opacity: 0;
    transform: translateY(5px);
    animation: cs-titleIntro 0.32s ease-out 1.16s forwards;
    white-space: nowrap;
}

.guide-title-icon {
    width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border: 2px solid var(--cs-blue);
    border-radius: 50%;
    color: var(--cs-blue);
    font-size: 12px;
    line-height: 1;
    font-weight: 500;
}

.guide-detail {
    width: 100%;
    max-height: 0;
    margin-top: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(12px);
    transition:
        max-height 0.34s cubic-bezier(0.16, 1, 0.3, 1),
        margin-top 0.34s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.22s ease 0.08s,
        transform 0.22s ease 0.08s,
        visibility 0.22s ease;
}

.guide-bubble:hover .guide-detail,
.guide-widget.is-guide-open .guide-detail,
.guide-widget:focus-within .guide-detail {
    max-height: 460px;
    margin-top: 22px;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.guide-video-placeholder {
    width: 320px;
    max-width: 100%;
    display: block;
    padding: 0;
    border: 0;
    background: #e6e6e6;
    color: #444;
    text-align: center;
    font-family: "Inter", "Noto Sans JP", sans-serif;
    font-size: 11px;
    line-height: 1.6;
    cursor: zoom-in;
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

.guide-video-placeholder iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    pointer-events: none;
}

/* ---------- guide video zoom modal ---------- */
.guide-video-modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 5vw;
    background: rgba(18, 24, 44, 0.46);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 50;
}

.guide-video-modal.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.guide-video-modal-frame {
    position: relative;
    width: min(1000px, 90vw);
    aspect-ratio: 16 / 9;
    background: #111827;
    box-shadow: 0 24px 72px rgba(0, 0, 0, 0.35);
}

.guide-video-modal-frame iframe {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
}

.guide-video-close {
    position: absolute;
    right: -14px;
    top: -48px;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.96);
    cursor: pointer;
}

.guide-video-close::before,
.guide-video-close::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: var(--cs-ink);
    transform-origin: center;
}

.guide-video-close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.guide-video-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.guide-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    margin-top: 18px;
    padding-bottom: 8px;
}

.guide-help-text {
    color: var(--cs-ink);
    font-family: "Inter", sans-serif;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.guide-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 86px;
    height: 28px;
    padding: 5px 10px;
    border-radius: 6px;
    background: var(--cs-blue);
    color: #fff;
    text-decoration: none;
    font-family: "Inter", sans-serif;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: background-color 0.16s ease;
}

.guide-link:hover,
.guide-link:focus-visible {
    background: var(--cs-blue-hover);
}

.guide-link-icon {
    width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    border: 2px solid currentColor;
    border-radius: 50%;
    font-size: 13px;
    line-height: 1;
    font-weight: 500;
}

@keyframes cs-bubbleIntro {
    0% {
        opacity: 0;
        width: 58px;
        min-height: 58px;
        padding: 0;
        border-radius: 999px;
    }

    12% {
        opacity: 1;
        width: 87px;
        min-height: 62px;
        padding: 0;
        border-radius: 999px;
    }

    74% {
        opacity: 1;
        width: 210px;
        min-height: 60px;
        padding: 16px 18px;
        border-radius: 32px;
    }

    100% {
        opacity: 1;
        width: 240px;
        min-height: 64px;
        padding: 20px;
        border-radius: 28px;
    }
}

@keyframes cs-bubbleTailIntro {
    to {
        opacity: 1;
    }
}

@keyframes cs-titleIntro {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cs-aiModeGlow {

    0%,
    23.8%,
    100% {
        opacity: 0;
        background-position: 118% 50%, 128% 50%;
    }

    1.4% {
        opacity: 1;
        background-position: 94% 50%, 76% 50%;
    }

    4.8% {
        opacity: 0;
        background-position: 54% 50%, -18% 50%;
    }
}

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

    .guide-bubble,
    .guide-bubble-title {
        animation: none;
        opacity: 1;
        transform: none;
    }
}
