* {
	box-sizing: border-box;
}

html, body {
	margin: 0;
	padding: 0;
	height: 100%;
	font-family: sans-serif;
	background-color: #f4f5f7;
	color: #222222;
}

.is_hidden {
	display: none !important;
}

.app_container {
	position: relative;
	display: flex;
	flex-direction: column;
	min-height: 100dvh;
	max-width: 540px;
	margin: 0 auto;
	background-color: #ffffff;
}

.menu_bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 14px;
	background-color: #1f2937;
	color: #ffffff;
	gap: 8px;
}

.menu_title {
	font-weight: bold;
	font-size: 1rem;
}

.menu_right {
	display: flex;
	align-items: center;
	gap: 8px;
}

.rate_box {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 5px 12px;
	background-color: #374151;
	border: 1px solid #4b5563;
	border-radius: 999px;
	font-size: 0.9rem;
	line-height: 1.2;
}

.rate_box label:first-child {
	color: #d1d5db;
	font-size: 0.82rem;
	font-weight: bold;
	padding-right: 8px;
	border-right: 1px solid #4b5563;
}

.rate_box label:last-child {
	color: #34d399;
	font-size: 1rem;
	font-weight: bold;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.02em;
}

.settings_btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid #4b5563;
	border-radius: 6px;
	background-color: #374151;
	color: #ffffff;
	cursor: pointer;
	touch-action: manipulation;
}

.settings_btn:active {
	background-color: #4b5563;
}

.display_area {
	padding: 14px 16px;
	background-color: #f9fafb;
	border-bottom: 1px solid #e5e7eb;
	text-align: right;
}

.result_display {
	font-size: clamp(1.8rem, 6vw, 2.6rem);
	font-weight: bold;
	line-height: 1.3;
	word-break: break-all;
	color: #111827;
}

.input_display {
	margin-top: 6px;
	font-size: clamp(1.1rem, 4vw, 1.4rem);
	line-height: 1.3;
	word-break: break-all;
	color: #4b5563;
	min-height: 1.4em;
}

.keypad_area {
	flex: 1 1 auto;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	padding: 12px;
	gap: 10px;
}

.empty_slot {
	min-height: 54px;
}

.calc_btn {
	min-height: 54px;
	padding: 10px;
	font-size: clamp(1.1rem, 4vw, 1.4rem);
	font-weight: bold;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	background-color: #ffffff;
	color: #111827;
	cursor: pointer;
	touch-action: manipulation;
}

.calc_btn:active {
	background-color: #e5e7eb;
}

.clear_btn {
	background-color: #fee2e2;
	border-color: #fca5a5;
	color: #991b1b;
}

.backspace_btn {
	background-color: #fef3c7;
	border-color: #fcd34d;
	color: #92400e;
}

/* レート一覧パネル */
.rate_list_panel {
	position: absolute;
	inset: 0;
	z-index: 10;
	display: flex;
	flex-direction: column;
	background-color: #ffffff;
}

.rate_list_header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 14px;
	background-color: #1f2937;
	color: #ffffff;
}

.rate_list_title {
	font-weight: bold;
	font-size: 1rem;
}

.close_list_btn {
	padding: 6px 12px;
	border: 1px solid #4b5563;
	border-radius: 6px;
	background-color: #374151;
	color: #ffffff;
	font-size: 0.85rem;
	cursor: pointer;
	touch-action: manipulation;
}

.close_list_btn:active {
	background-color: #4b5563;
}

.rate_list_body {
	flex: 1 1 auto;
	padding: 12px;
	overflow-y: auto;
}
.add_rate_row {
	display: flex;
	justify-content: flex-end;
	padding-bottom: 10px;
	margin-bottom: 4px;
	border-bottom: 1px solid #e5e7eb;
}

.add_rate_btn {
	padding: 8px 14px;
	border: 1px solid #10b981;
	border-radius: 6px;
	background-color: #ecfdf5;
	color: #065f46;
	font-size: 0.9rem;
	font-weight: bold;
	cursor: pointer;
	touch-action: manipulation;
}

.add_rate_btn:active {
	background-color: #d1fae5;
}

.rate_table {
	width: 100%;
	table-layout: fixed;
	border-collapse: collapse;
}

.rate_row {
	border-bottom: 1px solid #e5e7eb;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.rate_row:hover {
	background-color: #f9fafb;
}

.rate_row.is_selected {
	background-color: #ecfdf5;
}

.rate_table td {
	padding: 12px 8px;
	vertical-align: middle;
}

.rate_col_name {
	font-weight: bold;
	color: #111827;
	word-break: break-word;
}

.rate_col_value {
	width: 30%;
	text-align: right;
	font-weight: bold;
	font-variant-numeric: tabular-nums;
	color: #059669;
}

.rate_col_actions {
	width: 84px;
	text-align: right;
	white-space: nowrap;
}

.action_btn {
	width: 32px;
	height: 32px;
	padding: 0;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	background-color: #ffffff;
	color: #374151;
	font-size: 0.9rem;
	line-height: 1;
	cursor: pointer;
	touch-action: manipulation;
}

.action_btn + .action_btn {
	margin-left: 6px;
}

.action_btn:active {
	background-color: #e5e7eb;
}

.delete_btn:hover {
	background-color: #fee2e2;
	border-color: #fca5a5;
	color: #991b1b;
}

.edit_btn:hover {
	background-color: #fef3c7;
	border-color: #fcd34d;
	color: #92400e;
}

.status_bar {
	padding: 8px 14px;
	background-color: #e5e7eb;
	color: #374151;
	font-size: 0.85rem;
	border-top: 1px solid #d1d5db;
	min-height: 36px;
	display: flex;
	align-items: center;
}

@media (min-width: 768px) {
	.app_container {
		margin-top: 16px;
		margin-bottom: 16px;
		min-height: calc(100dvh - 32px);
		border: 1px solid #d1d5db;
		border-radius: 12px;
		overflow: hidden;
	}
}

.rate_form_area {
	margin-top: 12px;
	padding: 14px;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	background-color: #f9fafb;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.rate_form_title {
	font-weight: bold;
	font-size: 0.95rem;
	color: #111827;
}

.rate_form_row {
	display: flex;
	align-items: center;
	gap: 10px;
}

.rate_form_row label {
	width: 54px;
	font-weight: bold;
	font-size: 0.9rem;
	color: #374151;
}

.rate_form_input {
	flex: 1 1 auto;
	padding: 8px 10px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 1rem;
	background-color: #ffffff;
}

.rate_form_actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 4px;
}

.cancel_form_btn {
	padding: 8px 14px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	background-color: #ffffff;
	color: #374151;
	font-size: 0.9rem;
	font-weight: bold;
	cursor: pointer;
}

.submit_form_btn {
	padding: 8px 16px;
	border: none;
	border-radius: 6px;
	background-color: #2563eb;
	color: #ffffff;
	font-size: 0.9rem;
	font-weight: bold;
	cursor: pointer;
}
