/* ==========================================
   基本設定・スマホ誤作動防止
   ========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f4f5f7;
    color: #333333;
    line-height: 1.5;
    padding-bottom: 110px; /* 固定広告とコンテンツの重なりを防止 */
    user-select: none; /* テキストの誤選択を防止 */
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* 入力欄のテキスト選択は許可 */
textarea {
    user-select: text;
    -webkit-user-select: text;
}

/* ==========================================
   ヘッダー & レイアウト
   ========================================== */
.header {
    background-color: #1a1a1a;
    color: #ffffff;
    text-align: center;
    padding: 16px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}

/* ==========================================
   カードスタイル
   ========================================== */
.card {
    background: #ffffff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.card h2 {
    font-size: 1rem;
    color: #1a1a1a;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid #f0f0f0;
}

.label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 8px;
}

textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95rem;
    resize: none;
    word-break: break-all;
    outline: none;
    transition: border-color 0.2s;
}

textarea:focus {
    border-color: #1a1a1a;
}

/* ==========================================
   ボタン
   ========================================== */
.btn {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
    touch-action: manipulation; /* ダブルタップズーム防止 */
}

.btn:active {
    opacity: 0.8;
}

.btn-primary {
    background-color: #1a1a1a;
    color: #ffffff;
    margin-top: 12px;
}

.btn-secondary {
    background-color: #2563eb;
    color: #ffffff;
    margin-top: 16px;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid #d1d5db;
    color: #4b5563;
    margin-top: 12px;
}

/* ==========================================
   QRコード表示エリア
   ========================================== */
.result-card {
    text-align: center;
}

#qrcode-box {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    background-color: #ffffff;
}

#qrcode-box img, #qrcode-box canvas {
    max-width: 100%;
    height: auto;
}

/* ==========================================
   リストスタイル (履歴・お気に入り)
   ========================================== */
.item-list {
    list-style: none;
}

.item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
    gap: 8px;
}

.item-row:last-child {
    border-bottom: none;
}

.item-text {
    flex: 1;
    font-size: 0.875rem;
    color: #374151;
    word-break: break-all;
    cursor: pointer;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-icon-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
    color: #9ca3af;
    line-height: 1;
}

.action-icon-btn.active {
    color: #f59e0b;
}

.action-icon-btn.delete:active {
    color: #ef4444;
}

.empty-msg {
    font-size: 0.85rem;
    color: #9ca3af;
    text-align: center;
    padding: 12px 0;
}

/* ==========================================
   モーダル
   ========================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: flex-end;
}

.modal.open {
    display: flex;
}

.modal-content {
    background-color: #ffffff;
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    font-size: 1.1rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
}

.modal-list {
    overflow-y: auto;
    flex: 1;
}

/* ==========================================
   画面下部 固定広告エリア（位置ズレ・はみ出し修正版）
   ========================================== */
.fixed-ad-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    border-top: 1px solid #e5e7eb;
    text-align: center;
    z-index: 1000;
    min-height: 50px;
    padding: 4px 0;
    box-sizing: border-box;
}

/* admaxが生成する全要素の不要な余白をリセットし、幅を画面内に収める */
.fixed-ad-container * {
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* 広告表示ブロック（iframe/table/div等）を中央にブロック配置 */
.fixed-ad-container iframe,
.fixed-ad-container table,
.fixed-ad-container div,
.fixed-ad-container ins {
    display: block !important;
    margin: 0 auto !important;
    max-width: 100% !important;
}
