:root {
	--arsw-primary: #023047;
	--arsw-secondary: #219ebc;
	--arsw-soft: #8ecae6;
	--arsw-accent: #ffb703;
	--arsw-warm: #fb8501;
	--arsw-default-width: 760px;
	--arsw-default-font: 18px;
	--arsw-panel-bg: rgba(255, 255, 255, 0.92);
	--arsw-surface: rgba(255, 255, 255, 0.72);
	--arsw-text: #112432;
	--arsw-border: rgba(2, 48, 71, 0.14);
	--arsw-shadow: 0 24px 80px rgba(2, 48, 71, 0.18);
}

body.arsw-theme-dark {
	--arsw-panel-bg: rgba(4, 18, 27, 0.92);
	--arsw-surface: rgba(18, 39, 53, 0.78);
	--arsw-text: #f6fbff;
	--arsw-border: rgba(142, 202, 230, 0.18);
	--arsw-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
	background: linear-gradient(180deg, rgba(2, 48, 71, 0.16), transparent 30%);
}

body.arsw-theme-sepia {
	--arsw-panel-bg: rgba(252, 245, 232, 0.94);
	--arsw-surface: rgba(255, 248, 238, 0.82);
	--arsw-text: #4d3a1d;
	--arsw-border: rgba(123, 90, 33, 0.12);
}

body.arsw-reader-open {
	overflow-x: hidden;
}

#arsw-reader-root {
	position: relative;
	max-width: var(--arsw-default-width);
	margin-inline: auto;
	font-family: "Roboto", sans-serif;
	font-size: var(--arsw-default-font);
	line-height: 1.85;
	color: var(--arsw-text);
	transition: max-width 0.25s ease, font-size 0.25s ease, color 0.25s ease;
}

#arsw-reader-root h1,
#arsw-reader-root h2,
#arsw-reader-root h3,
#arsw-reader-root h4,
#arsw-reader-root h5,
#arsw-reader-root h6 {
	font-family: "DM Sans", sans-serif;
	letter-spacing: -0.03em;
	color: var(--arsw-primary);
}

body.arsw-theme-dark #arsw-reader-root h1,
body.arsw-theme-dark #arsw-reader-root h2,
body.arsw-theme-dark #arsw-reader-root h3,
body.arsw-theme-dark #arsw-reader-root h4,
body.arsw-theme-dark #arsw-reader-root h5,
body.arsw-theme-dark #arsw-reader-root h6 {
	color: #f3fbff;
}

body.arsw-font-dm-sans #arsw-reader-root {
	font-family: "DM Sans", sans-serif;
}

body.arsw-font-opendyslexic #arsw-reader-root {
	font-family: Arial, Verdana, sans-serif;
	letter-spacing: 0.02em;
	word-spacing: 0.06em;
}

.arsw-progress-bar {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 4px;
	z-index: 99997;
	background: rgba(2, 48, 71, 0.07);
}

.arsw-progress-bar span {
	display: block;
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, var(--arsw-secondary), var(--arsw-accent), var(--arsw-warm));
	box-shadow: 0 0 18px rgba(251, 133, 1, 0.35);
}

.arsw-launcher {
	position: fixed;
	right: 22px;
	bottom: 22px;
	z-index: 99998;
	border: 0;
	border-radius: 999px;
	padding: 14px 20px;
	font-family: "DM Sans", sans-serif;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: -0.02em;
	background: linear-gradient(135deg, var(--arsw-primary), var(--arsw-secondary));
	color: #fff;
	box-shadow: var(--arsw-shadow);
	cursor: pointer;
}

.arsw-panel {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(410px, 100%);
	z-index: 99999;
	display: flex;
	flex-direction: column;
	background:
		radial-gradient(circle at top left, rgba(142, 202, 230, 0.4), transparent 30%),
		radial-gradient(circle at bottom right, rgba(255, 183, 3, 0.26), transparent 28%),
		var(--arsw-panel-bg);
	backdrop-filter: blur(22px);
	box-shadow: -28px 0 80px rgba(2, 48, 71, 0.16);
	transform: translateX(100%);
	transition: transform 0.28s ease;
}

body.arsw-reader-open .arsw-panel {
	transform: translateX(0);
}

.arsw-panel__header,
.arsw-section,
.arsw-stat-card,
.arsw-note-item,
.arsw-ai-output {
	border: 1px solid var(--arsw-border);
	background: var(--arsw-surface);
}

.arsw-panel__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	padding: 22px;
	margin: 18px 18px 10px;
	border-radius: 24px;
}

.arsw-eyebrow {
	margin: 0 0 6px;
	font-family: "DM Sans", sans-serif;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.14em;
	color: var(--arsw-secondary);
}

.arsw-panel__header h2 {
	margin: 0;
	font-family: "DM Sans", sans-serif;
	font-size: 28px;
	line-height: 1.05;
	color: var(--arsw-text);
}

.arsw-close {
	border: 0;
	background: transparent;
	font-size: 30px;
	line-height: 1;
	color: var(--arsw-text);
	cursor: pointer;
}

.arsw-panel__scroll {
	padding: 0 18px 24px;
	overflow-y: auto;
}

.arsw-section {
	margin: 12px 0;
	padding: 18px;
	border-radius: 22px;
}

.arsw-section h3 {
	margin: 0 0 14px;
	font-family: "DM Sans", sans-serif;
	font-size: 18px;
	color: var(--arsw-primary);
}

body.arsw-theme-dark .arsw-section h3 {
	color: var(--arsw-soft);
}

.arsw-stats {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}

.arsw-stats div {
	border-radius: 18px;
	padding: 12px;
	background: rgba(255, 255, 255, 0.56);
}

body.arsw-theme-dark .arsw-stats div {
	background: rgba(255, 255, 255, 0.06);
}

.arsw-stats span {
	display: block;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	opacity: 0.72;
}

.arsw-stats strong {
	display: block;
	margin-top: 6px;
	font-size: 24px;
	font-family: "DM Sans", sans-serif;
}

.arsw-chip-row {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.arsw-chip-row button,
.arsw-section select,
.arsw-section textarea {
	border: 1px solid var(--arsw-border);
	border-radius: 16px;
	background: rgba(255, 255, 255, 0.75);
	color: var(--arsw-text);
}

body.arsw-theme-dark .arsw-chip-row button,
body.arsw-theme-dark .arsw-section select,
body.arsw-theme-dark .arsw-section textarea {
	background: rgba(255, 255, 255, 0.08);
}

.arsw-chip-row button {
	padding: 10px 14px;
	font-family: "Roboto", sans-serif;
	font-size: 14px;
	cursor: pointer;
}

.arsw-chip-row button.is-active {
	border-color: transparent;
	background: linear-gradient(135deg, var(--arsw-accent), var(--arsw-warm));
	color: #1d1400;
	font-weight: 700;
}

.arsw-section label {
	display: block;
	margin-bottom: 12px;
	font-size: 14px;
	font-weight: 500;
}

.arsw-section input[type="range"],
.arsw-section select,
.arsw-section textarea {
	width: 100%;
	margin-top: 8px;
}

.arsw-section textarea,
.arsw-section select {
	padding: 12px;
}

.arsw-note-list {
	display: grid;
	gap: 10px;
	margin-top: 14px;
}

.arsw-note-item {
	padding: 12px 14px;
	border-radius: 16px;
}

.arsw-note-item strong {
	display: block;
	margin-bottom: 8px;
	color: var(--arsw-primary);
}

.arsw-pro-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
}

.arsw-pro-header span {
	display: inline-flex;
	padding: 6px 10px;
	border-radius: 999px;
	background: linear-gradient(135deg, var(--arsw-accent), var(--arsw-warm));
	color: #311c00;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.arsw-ai-output {
	margin-top: 12px;
	padding: 14px;
	border-radius: 18px;
	font-size: 14px;
}

.arsw-reader-root p.is-focused,
.arsw-reader-root li.is-focused {
	background: linear-gradient(90deg, rgba(255, 183, 3, 0.14), rgba(142, 202, 230, 0.12));
	border-radius: 8px;
}

body.arsw-focus-blur #arsw-reader-root > * {
	opacity: 0.4;
	filter: blur(1.8px);
	transition: opacity 0.2s ease, filter 0.2s ease;
}

body.arsw-focus-blur #arsw-reader-root > *.is-focused {
	opacity: 1;
	filter: none;
}

body.arsw-focus-line #arsw-reader-root p.is-focused,
body.arsw-focus-line #arsw-reader-root li.is-focused {
	box-shadow: inset 0 -0.5em 0 rgba(255, 183, 3, 0.22);
}

body.arsw-high-contrast {
	--arsw-text: #050505;
	--arsw-primary: #000;
	--arsw-panel-bg: rgba(255, 255, 255, 0.98);
}

body.arsw-high-contrast #arsw-reader-root a {
	color: #003cff;
	text-decoration: underline;
}

mark.arsw-highlight {
	padding: 0.04em 0.18em;
	border-radius: 0.2em;
	background: rgba(255, 183, 3, 0.38);
}

body.arsw-keyboard-mode #arsw-reader-root :focus-visible,
.arsw-panel button:focus-visible,
.arsw-panel input:focus-visible,
.arsw-panel textarea:focus-visible,
.arsw-panel select:focus-visible {
	outline: 3px solid var(--arsw-warm);
	outline-offset: 2px;
}

@media (max-width: 782px) {
	.arsw-panel {
		width: 100%;
	}

	.arsw-launcher {
		right: 16px;
		left: 16px;
		bottom: 16px;
		justify-content: center;
	}

	.arsw-stats {
		grid-template-columns: 1fr;
	}
}
