/* ベーススタイル */
.all_body { 
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
	margin: 0; 
	padding: 0; 
	background-color: #f4f4f4; 
	color: #333; 
	touch-action: manipulation; 
}
.container { 
	max-width: 600px; 
	width: 100%; /* 追加: スマホでは画面いっぱいに */
	margin: 0 auto; 
	padding: 20px; 
	background-color: #fff; 
	min-height: 100vh; 
	padding-bottom: 80px; 
}
h2 { 
	border-bottom: 2px solid #555; 
	padding-bottom: 10px; 
	margin-top: 0;
	font-size: 1.4rem; /* スマホで大きすぎないように */ 
}

/* 共通ボタン・フォーム */
.btn { padding: 12px 15px; border: none; border-radius: 6px; cursor: pointer; font-size: 16px; margin: 5px 0; touch-action: manipulation; }
.btn-primary { background-color: #007bff; color: white; width: 100%; font-weight: bold; padding: 16px; }
.btn-success { background-color: #28a745; color: white; width: 100%; font-weight: bold; padding: 20px; font-size: 1.2em; margin-top: 20px; box-shadow: 0 4px 0 #218838; }
.btn-success:active { transform: translateY(4px); box-shadow: none; }
.btn-danger { background-color: #dc3545; color: white; }
.btn-outline { background-color: transparent; border: 2px solid #ccc; color: #333; font-weight: bold; }
.form-group { margin-bottom: 15px; }
label { display: block; margin-bottom: 5px; font-weight: bold; }
input[type="text"], input[type="number"] { width: 100%; padding: 12px; box-sizing: border-box; font-size: 16px; border: 1px solid #ddd; border-radius: 4px; }

/* フェーズ管理 */
.phase { display: none; }
.phase.active { display: block; }

/* 登録フェーズ */
.item-input-row { display: flex; gap: 10px; margin-bottom: 10px; align-items: center; }
.item-input-row input.name { flex: 2; }
.item-input-row input.price { flex: 1; }

/* 会計フェーズ */
.pos-item-row { display: flex; align-items: center; margin-bottom: 12px; background: #fff; padding: 8px; border-radius: 8px; border: 1px solid #ddd; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.pos-main-btn { flex: 1; text-align: left; background: none; border: none; padding: 5px; cursor: pointer; -webkit-tap-highlight-color: rgba(0,0,0,0); }
.pos-item-name { font-size: 1.1em; font-weight: bold; display: block; margin-bottom: 4px; }
.pos-item-price { color: #666; font-size: 0.9em; }
.pos-controls { display: flex; align-items: center; gap: 8px; margin-left: 10px; }
.qty-btn { width: 44px; height: 44px; font-size: 24px; border-radius: 8px; border: 1px solid #bbb; background: #f8f8f8; color: #333; display: flex; align-items: center; justify-content: center; padding: 0; touch-action: manipulation; }
.qty-btn:active { background: #ddd; }
.qty-display { width: 30px; text-align: center; font-weight: bold; font-size: 18px; }

.total-area { background-color: #222; color: #fff; padding: 15px; border-radius: 8px; margin-bottom: 15px; position: sticky; top: 0; z-index: 90; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.total-label { font-size: 0.8em; color: #aaa; }
.total-price { font-size: 2.2em; text-align: right; font-weight: bold; line-height: 1; margin-bottom: 5px;}
.breakdown { font-size: 0.85em; border-top: 1px solid #444; margin-top: 8px; padding-top: 8px; white-space: pre-wrap; line-height: 1.4; color: #ddd; max-height: 100px; overflow-y: auto; }

/* カスタムモーダル（alert代替） */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 1000; justify-content: center; align-items: center; }
.modal-box { 
    background: white; 
    width: 85%; 
    max-width: 350px; 
    padding: 25px; 
    border-radius: 12px; 
    text-align: center; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); 
}
.modal-title { font-size: 1.2em; font-weight: bold; margin-bottom: 10px; display: block;}
.modal-message { font-size: 1.5em; margin: 20px 0; font-weight: bold; color: #007bff; word-break: break-all; /* 長い文字でも改行させる */ }
.modal-buttons { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }
.modal-btn-ok { background: #007bff; color: white; border: none; padding: 12px 30px; border-radius: 6px; font-size: 1.1em; flex: 1;}
.modal-btn-cancel { background: #6c757d; color: white; border: none; padding: 12px 20px; border-radius: 6px; font-size: 1em; }

/* リザルト画面 */
.result-box { 
	background: #f9f9f9;
	padding: 15px;
	border: 1px solid #ddd;
	border-radius: 5px;
	margin-bottom: 20px;
	font-family: monospace;
	white-space: pre-wrap;
	overflow-x: auto;
	font-size: 14px;
}
.table-wrap {
	overflow-x: auto; /* テーブルがはみ出す場合にスクロールさせる */
    -webkit-overflow-scrolling: touch;
}
table {
	width: 100%; 
	border-collapse: collapse; 
	margin-top: 10px; 
	font-size: 13px; 
}
th, td { 
	border: 1px solid #ddd; 
	padding: 8px; 
	text-align: left; 
}
th { 
	background-color: #f2f2f2; 
	white-space: nowrap; 
}
/* 追加レイアウト調整：単位選択用 */
.item-input-row input.name { flex: 4 !important; } /* 名前エリア */
.item-input-row input.price { flex: 2 !important; } /* 値段エリア */
.item-input-row select.unit { 
    flex: 1.5; 
    padding: 12px 5px; 
    border: 1px solid #ddd; 
    border-radius: 4px; 
    background: white; 
    font-size: 14px;
}