body {
    margin: 0;
    padding: 0;
    background: #f5f5f5;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #222;
}

.container {
    max-width: 520px;
    margin: 0 auto;
    padding: 18px;
}

h1 {
    font-size: 32px;
    margin-bottom: 8px;
}

.lead {
    font-size: 15px;
    color: #555;
}

.upload-box {
    background: #ffffff;
    padding: 16px;
    border-radius: 14px;
    margin: 18px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,.08);
}

input[type="file"] {
    width: 100%;
    margin-bottom: 14px;
}

button {
    width: 100%;
    padding: 14px;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    background: #222;
    color: #fff;
    cursor: pointer;
    transition: .2s;
}

button:hover {
    opacity: .95;
}

button:active {
    transform: scale(.98);
}

button:disabled {
    background: #888;
    cursor: not-allowed;
}

.status {
    margin: 16px 0;
    font-weight: bold;
}

.card {
    background: #ffffff;
    border-radius: 18px;
    padding: 18px;
    margin: 18px 0;
    box-shadow: 0 3px 14px rgba(0,0,0,.10);
}

.no {
    font-size: 16px;
    font-weight: bold;
    color: #555;
}

.title {
    font-size: 20px;
    font-weight: bold;
    margin: 12px 0 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.premium {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 16px;
}

.info-row {
    font-size: 16px;
    margin: 8px 0;
}

.skip-card {
    background: #fff8e1;
}

.skip-text {
    font-size: 18px;
    font-weight: bold;
    color: #8a6d00;
}

.error-card {
    background: #fdecea;
}

.error-text {
    font-size: 16px;
    font-weight: bold;
    color: #d93025;
}

/* ==========================
   プレ値本（100%以上）
========================== */

.premium-card {
    background: #fff1f1;
    border: 2px solid #ff5b5b;
    box-shadow: 0 6px 18px rgba(255,80,80,.15);
}

.premium-red {
    color: #d60000;
    font-weight: bold;
}

/* ==========================
   Keepaボタン
========================== */

.keepa-button {

    width: 100%;

    margin-top: 16px;

    padding: 14px;

    border: none;

    border-radius: 12px;

    background: #2563eb;

    color: #fff;

    font-size: 17px;

    font-weight: bold;

    cursor: pointer;

    transition: .2s;

    box-shadow: 0 3px 10px rgba(37,99,235,.30);

}

.keepa-button:hover {

    background: #1d4ed8;

}

.keepa-button:active {

    transform: scale(.98);

}

.keepa-button.opened {

    background: #ef4444;

}

.keepa-button.opened:hover {

    background: #dc2626;

}

/* ==========================
   Keepa画像
========================== */

.keepa-area {

    margin-top: 14px;

}

.keepa-image {

    width: 100%;

    display: block;

    border-radius: 12px;

    border: 1px solid #ddd;

    background: #fff;

    box-shadow: 0 2px 8px rgba(0,0,0,.08);

}

.upload-buttons{

    display:flex;

    flex-direction:column;

    gap:12px;

}

#cameraButton{

    background:#2d8cff;

}

#galleryButton{

    background:#38b36b;

}

#startButton{

    background:#222;

}

#cameraButton:hover{

    background:#1976d2;

}

#galleryButton:hover{

    background:#2b9658;

}

.upload-buttons {

    display: flex;

    flex-direction: column;

    gap: 12px;

}

.upload-button {

    display: block;

    width: 100%;

    padding: 14px;

    border-radius: 12px;

    text-align: center;

    font-size: 18px;

    font-weight: bold;

    color: #fff;

    cursor: pointer;

    box-sizing: border-box;

    transition: .2s;

}

.upload-button:hover {

    opacity: .95;

}

.upload-button:active {

    transform: scale(.98);

}

.camera {

    background: #2d8cff;

}

.camera:hover {

    background: #1976d2;

}

.gallery {

    background: #38b36b;

}

.gallery:hover {

    background: #2b9658;

}

#startButton {

    background: #222;

}

/* ==========================
   判定方法
========================== */

.judge-box{

    margin-bottom:20px;

    padding:16px;

    background:#f7f7f7;

    border-radius:12px;

}

.judge-title{

    font-size:18px;

    font-weight:bold;

    margin-bottom:12px;

}

.judge-option{

    display:block;

    margin-bottom:10px;

    font-size:16px;

    cursor:pointer;

}

.judge-option input{

    margin-right:8px;

}

.threshold-row{

    display:flex;

    align-items:center;

    gap:10px;

    margin-top:12px;

}

#priceThreshold{

    width:90px;

    padding:8px;

    font-size:16px;

    border:1px solid #ccc;

    border-radius:8px;

}

.api-settings {
    margin-bottom: 20px;
    background: #f7f7f7;
    border-radius: 12px;
    overflow: hidden;
}

.api-settings summary {
    padding: 16px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    list-style: none;
}

.api-settings summary::-webkit-details-marker {
    display: none;
}

.api-settings summary::after {
    content: "▼";
    float: right;
    transition: transform 0.2s;
}

.api-settings[open] summary::after {
    transform: rotate(180deg);
}

.api-settings-body {
    padding: 0 16px 16px;
}

.api-settings .api-key-box {
    margin-bottom: 14px;
    padding: 14px;
    background: #ffffff;
    border-radius: 12px;
}

.api-settings .api-key-box:last-child {
    margin-bottom: 0;
}

#geminiApiKey,
#spapiRefreshToken,
#spapiLwaAppId,
#spapiLwaClientSecret {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-sizing: border-box;
}

/* -----------------------------
   OCR辞書追加
----------------------------- */

.dictionary-box {
    margin-top: 18px;
    padding: 14px;
    border-radius: 14px;
    background: #f7f7f7;
    border: 1px solid #e0e0e0;
}

.dictionary-box summary {
    cursor: pointer;
    font-weight: 700;
    font-size: 15px;
    color: #222;
}

.dictionary-form {
    margin-top: 14px;
}

.dictionary-row {
    margin-bottom: 12px;
}

.dictionary-row label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 700;
    color: #333;
}

.dictionary-row input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #ccc;
    font-size: 16px;
    background: #fff;
}

.dictionary-row input:focus {
    outline: none;
    border-color: #2f6fed;
    box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.15);
}

.dictionary-arrow {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: #777;
    margin: -2px 0 8px;
}

.dictionary-button {
    width: 100%;
    margin-top: 4px;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: #222;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.dictionary-button:hover {
    opacity: 0.9;
}

.dictionary-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.dictionary-status {
    margin-top: 10px;
    font-size: 14px;
    font-weight: 700;
}

.dictionary-status.success {
    color: #0a7a35;
}

.dictionary-status.error {
    color: #c62828;
}

/* -----------------------------
   OCR単語ボタン
----------------------------- */

.ocr-word-list {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ocr-word-button {
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid #ccc;
    background: #fff;
    color: #222;
    font-size: 14px;
    cursor: pointer;
}

.ocr-word-button:hover {
    background: #eef3ff;
    border-color: #2f6fed;
}

.ocr-word-button:active {
    transform: scale(0.98);
}

/* -----------------------------
   背表紙画像
----------------------------- */

.spine-detail {
    margin-top: 10px;
}

.spine-detail summary {
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
}

.spine-image-box {
    margin-top: 10px;
    padding: 10px;
    border-radius: 12px;
    background: #f7f7f7;
    text-align: center;
}

.spine-image {
    max-width: 100%;
    max-height: 360px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
}

/* -----------------------------
   棚の位置画像
----------------------------- */

.spine-position-detail {
    margin-top: 10px;
}

.spine-position-detail summary {
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
}

.spine-position-box {
    margin-top: 10px;
    padding: 10px;
    border-radius: 12px;
    background: #f7f7f7;
    text-align: center;
    overflow-x: auto;
}

.spine-position-image {
    max-width: 100%;
    max-height: 420px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
}

/* -----------------------------
   画像拡大モーダル
----------------------------- */

.image-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.image-modal.open {
    display: block;
}

.image-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
}

.image-modal-content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.image-modal-img {
    max-width: 95vw;
    max-height: 90vh;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.image-modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 999px;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    background: #fff;
    color: #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    z-index: 10000;
}

.clickable-image {
    cursor: zoom-in;
}

.clickable-image:hover {
    opacity: 0.9;
}
.stop-mode {
    background: #d93025 !important;
    box-shadow: 0 8px 18px rgba(217, 48, 37, 0.25) !important;
}
