* {
	box-sizing: border-box;
}

body {
	margin: 0;
	min-height: 100vh;
	padding: 20px;
	display: flex;
	justify-content: center;
	align-items: center;
	font-family: "Segoe UI", Arial, sans-serif;
	background: linear-gradient(135deg, #f0f4f8, #d9e2ec);
	color: #333;
}

a {
	text-decoration: none;
}

#container {
	width: min(500px, 100%);
	background: #fff;
	margin: 20px auto;
	padding: 25px;
	border-radius: 12px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
	text-align: center;
}

h1 {
	margin: 0 0 8px;
	font-size: 1.6rem;
	color: #333;
}

.subtitle {
	margin: 0 0 22px;
	color: #777;
	font-size: 0.9rem;
}

/* =========================
	 DROP AREA
========================= */

#drop-area {
	border: 2px dashed #aaa;
	border-radius: 10px;
	padding: 28px 20px;
	color: #666;
	transition: 0.25s;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	outline: none;
}

#drop-area:hover,
#drop-area:focus {
	border-color: #0078d7;
	background: #f8fcff;
}

#drop-area.dragover {
	border-color: #0078d7;
	background: #f0faff;
	color: #0078d7;
}

#drop-area p {
	margin: 5px 0;
}

.drop-main {
	font-size: 1.05rem;
	font-weight: 600;
}

.drop-or {
	color: #999;
	font-size: 0.85rem;
}

.browse-files {
	margin-top: 10px;
	border: 2px solid #0078d7;
	border-radius: 8px;
	background: #fff;
	color: #0078d7;
	display: inline-block;
	padding: 8px 22px;
	cursor: pointer;
	transition: 0.2s;
	font-weight: 500;
}

.browse-files:hover {
	background: #eee;
}

input[type="file"] {
	display: none;
}

.paste-info {
	margin-top: 12px !important;
	font-size: 0.78rem;
	color: #999;
}

/* =========================
	 TOP ACTIONS
========================= */

.top-actions {
	display: flex;
	gap: 10px;
	margin-top: 15px;
}

.top-actions button {
	flex: 1;
}

button {
	font-family: inherit;
}

.btn {
	border: none;
	border-radius: 8px;
	padding: 9px 15px;
	cursor: pointer;
	font-size: 0.9rem;
	transition: 0.2s;
}

.btn-primary {
	background: #0078d7;
	color: #fff;
}

.btn-primary:hover {
	background: #005fa3;
}

.btn-secondary {
	background: #eee;
	color: #333;
}

.btn-secondary:hover {
	background: #ddd;
}

.btn-danger {
	background: #f44336;
	color: #fff;
}

.btn-danger:hover {
	background: #d32f2f;
}


/* =========================
	 CAMERA
========================= */

#camera-section {
	display: none;
	margin-top: 18px;
}

#camera-container {
	position: relative;
	overflow: hidden;
	border-radius: 10px;
	background: #111;
}

#camera-video {
	width: 100%;
	display: block;
	aspect-ratio: 1 / 1;
	object-fit: cover;
}

.scan-frame {
	position: absolute;
	width: 60%;
	aspect-ratio: 1 / 1;
	top: 20%;
	left: 20%;
	border: 3px solid #fff;
	border-radius: 12px;
	box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.25);
	pointer-events: none;
}

#stop-camera {
	margin-top: 10px;
	width: 100%;
}

/* =========================
	 PREVIEW
========================= */

#preview-container {
	display: none;
	margin-top: 18px;
}

#preview-image {
	max-width: 100%;
	max-height: 280px;
	border: 1px solid #ddd;
	object-fit: contain;
}

/* =========================
	 RESULT
========================= */

#result-box {
	display: none;
	margin-top: 20px;
	padding: 18px;
	border-radius: 10px;
	text-align: left;
	word-break: break-word;
	overflow-wrap: anywhere;
	white-space: pre-wrap;
	font-size: 0.95rem;
	line-height: 1.5;
}

#result-box.success {
	border: 1px solid #4caf50;
	background: #e8f5e9;
	color: #2e7d32;
}

#result-box.error {
	border: 1px solid #f44336;
	background: #ffebee;
	color: #c62828;
}

#result-box.loading {
	border: 1px solid #aaa;
	background: #f5f5f5;
	color: #555;
}

.result-header {
	font-weight: 700;
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: 10px;
	color: #666;
}

.result-content {
	color: #222;
}

.result-row {
	margin: 6px 0;
}

.result-label {
	font-weight: 600;
}

.password-hidden {
	letter-spacing: 2px;
}


/* =========================
	 ACTION BUTTONS
========================= */

#actions {
	display: none;
	margin-top: 10px;
	text-align: left;
	flex-wrap: wrap;
	gap: 8px;
}

#actions .btn {
	flex: 1;
	min-width: 110px;
}


/* =========================
	 SERVER SAVE STATUS
========================= */

#save-status {
	display: none;
	margin-top: 8px;
	font-size: 0.78rem;
	text-align: center;
}

#save-status.saving {
	display: block;
	color: #777;
}

#save-status.saved {
	display: block;
	color: #2e7d32;
}

#save-status.failed {
	display: block;
	color: #c62828;
}

/* =========================
	 HISTORY
========================= */

#history-section {
	margin-top: 25px;
	border-top: 1px solid #ddd;
	padding-top: 18px;
	text-align: left;
}

#history-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 10px;
}

#history-header h2 {
	margin: 0;
	font-size: 1rem;
}

#history-list {
	display: none;
}

.history-item {
	padding: 10px;
	border-radius: 7px;
	background: #f7f7f7;
	margin-bottom: 7px;
	cursor: pointer;
	transition: 0.2s;
}

.history-item:hover {
	background: #eee;
}

.history-type {
	font-size: 0.75rem;
	font-weight: 700;
	color: #0078d7;
	text-transform: uppercase;
}

.history-value {
	margin-top: 3px;
	font-size: 0.82rem;
	color: #555;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.history-time {
	margin-top: 3px;
	font-size: 0.7rem;
	color: #999;
}


/* =========================
	 HEADER
========================= */
.site-header {
	width: 100%;
	max-width: 1200px;
	height: 70px;
	margin-bottom: 19px;
	padding: 0 2px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.logo {
	display: flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
}

.tool-switcher {
	display: flex;
	align-items: center;
	padding: 4px;
	gap: 4px;
	background: #f4f4f5;
	border: 2px solid #ffc067;
	border-radius: 12px;
}

.tool-link {
	padding: 4px 14px;
	color: #666;
	text-decoration: none;
	letter-spacing: 1px;
	font-size: 14px;
	border-radius: 8px;
	transition: all 0.2s ease;
}

.tool-link:hover {
	color: #111;
	background: #ffffff;
}

.tool-link.active {
	background: #ffc067;
	color: #fff;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
	cursor: default;
	pointer-events: none;
}

/* =========================
	 FOOTER
========================= */
.footer {
	margin-top: 39px;
	font-size: 0.9rem;
	color: #ef811a;
}

/* =========================
	 PRIVACY
========================= */

.privacy-note {
	margin-top: 20px;
	font-size: 0.75rem;
	color: #888;
	line-height: 1.4;
}


/* =========================
	 MOBILE
========================= */

@media (max-width: 500px) {

body {
	padding: 10px;
	align-items: flex-start;
}

#container {
	margin-top: 10px;
	padding: 20px;
}

.top-actions {
	flex-direction: column;
}

#drop-area {
	padding: 22px 15px;
}

}
