


#ai-view {
	--bg: #171717;
	--bg-deep: #121212;
	--surface: #242424;
	--surface-2: #2c2c2c;
	--border: rgba(255, 255, 255, 0.08);
	--border-strong: rgba(255, 255, 255, 0.14);
	--text: #ececec;
	--text-dim: #b4b4b4;
	--text-faint: #888888;
	--accent: #ffffff;
	--accent-contrast: #111111;
	--accent-soft: rgba(255, 255, 255, 0.1);
	--accent-line: rgba(255, 255, 255, 0.28);
	--radius-xs: 8px;
	--radius-sm: 12px;
	--shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
	--shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);

	display: flex;
	height: 100vh;
	overflow: hidden;
	font-family: var(--font-ai);
	color: var(--text);
	background: var(--bg);
}

.ai-sidebar {
	display: flex;
	flex-direction: column;
	flex-shrink: 0;
	width: 260px;
	background: var(--bg-deep);
	border-right: 1px solid var(--border);
}

.ai-sidebar-brand {
	display: flex;
	gap: 9px;
	align-items: center;
	padding: 15px 14px 4px;
}

.ai-brand-mark {
	display: flex;
	flex-shrink: 0;
	width: 24px;
	height: 24px;
}

.ai-brand-mark svg {
	width: 100%;
	height: 100%;
}

.ai-brand-name {
	font-size: 0.93rem;
	font-weight: 700;
	color: var(--text);
}

.ai-sidebar-head {
	padding: 10px 13px 13px;
}

.ai-new-chat {
	display: flex;
	width: 100%;
	gap: 7px;
	align-items: center;
	justify-content: center;
	padding: 9px;
	font-family: inherit;
	font-size: 0.83rem;
	font-weight: 500;
	color: var(--text);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-xs);
	cursor: pointer;
	transition: all var(--ease);
}

.ai-new-chat:hover {
	background: var(--surface-2);
	border-color: var(--border-strong);
}

.ai-new-chat svg {
	width: 14px;
	height: 14px;
}

.ai-chat-list {
	flex: 1;
	padding: 8px;
	overflow-y: auto;
}

.ai-chat-row {
	display: flex;
	gap: 4px;
	align-items: center;
	border-radius: var(--radius-xs);
	transition: background var(--ease);
}

.ai-chat-row:hover {
	background: var(--surface);
}

.ai-chat-row.active {
	background: var(--accent-soft);
}

.ai-chat-label {
	flex: 1;
	overflow: hidden;
	padding: 9px 10px;
	font-family: inherit;
	font-size: 0.82rem;
	color: var(--text-dim);
	text-align: left;
	text-overflow: ellipsis;
	white-space: nowrap;
	background: none;
	border: none;
	cursor: pointer;
}

.ai-chat-row.active .ai-chat-label {
	color: var(--accent);
}

.ai-chat-rename,
.ai-chat-delete {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	margin-right: 2px;
	color: var(--text-faint);
	background: none;
	border: none;
	border-radius: 5px;
	opacity: 0;
	cursor: pointer;
}

.ai-chat-delete {
	margin-right: 5px;
}

.ai-chat-row:hover .ai-chat-rename,
.ai-chat-row:hover .ai-chat-delete {
	opacity: 1;
}

.ai-chat-rename:hover {
	color: var(--text);
}

.ai-chat-delete:hover {
	color: var(--danger);
}

.ai-chat-rename-input {
	flex: 1;
	min-width: 0;
	padding: 8px 9px;
	margin: 0 1px;
	font-family: inherit;
	font-size: 0.82rem;
	color: var(--text);
	background: var(--surface-2);
	border: 1px solid var(--accent-line);
	border-radius: 6px;
	outline: none;
}

.ai-main {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
}

.ai-header {
	display: flex;
	flex-shrink: 0;
	gap: 11px;
	align-items: center;
	padding: 11px 18px;
	border-bottom: 1px solid var(--border);
}

.ai-header h2 {
	font-family: inherit;
	font-size: 0.93rem;
	font-weight: 700;
}

.ai-header-right {
	margin-left: auto;
}

.ai-messages {
	flex: 1;
	padding: 26px 18px;
	overflow-y: auto;
}

.ai-empty {
	display: flex;
	flex-direction: column;
	gap: 12px;
	align-items: center;
	justify-content: center;
	height: 100%;
	text-align: center;
}

.ai-empty-title {
	font-family: inherit;
	font-size: 1.7rem;
	font-weight: 700;
	color: var(--text);
}

.ai-message {
	display: flex;
	gap: 13px;
	max-width: 780px;
	margin: 0 auto 26px;
	animation: rise 0.22s ease;
}


.ai-message.user {
	justify-content: flex-end;
}

.ai-message.user .ai-avatar {
	display: none;
}

.ai-message.user .ai-message-col {
	flex: 0 1 auto;
	max-width: 76%;
}

.ai-avatar {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	margin-top: 2px;
	color: var(--accent);
	background: var(--accent-soft);
	border-radius: 8px;
}

.ai-message-col {
	min-width: 0;
	flex: 1;
}

.ai-message-body {
	font-size: 0.92rem;
	line-height: 1.65;
	color: var(--text);
	word-wrap: break-word;
}

.ai-message.user .ai-message-body {
	padding: 10px 15px;
	white-space: pre-wrap;
	background: var(--surface-2);
	border-radius: 17px;
	box-shadow: var(--shadow);
}

.ai-message.error .ai-message-body {
	padding: 11px 14px;
	font-size: 0.85rem;
	color: var(--danger);
	background: rgba(248, 113, 113, 0.08);
	border: 1px solid rgba(248, 113, 113, 0.25);
	border-radius: var(--radius-sm);
}

.ai-message-actions {
	display: flex;
	gap: 6px;
	align-items: center;
	margin-top: 8px;
	opacity: 0;
	transition: opacity var(--ease);
}

.ai-message.user .ai-message-actions {
	justify-content: flex-end;
}

.ai-message:hover .ai-message-actions {
	opacity: 1;
}

.ai-message-actions button {
	padding: 3px 9px;
	font-family: inherit;
	font-size: 0.72rem;
	color: var(--text-faint);
	background: none;
	border: 1px solid var(--border);
	border-radius: 5px;
	cursor: pointer;
	transition: all var(--ease);
}

.ai-message-actions button:hover {
	color: var(--text);
	border-color: var(--border-strong);
}



.ai-msg-attachments {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	justify-content: flex-end;
	margin-bottom: 6px;
}

.ai-msg-attachment {
	overflow: hidden;
	border-radius: 12px;
	box-shadow: var(--shadow);
}

.ai-msg-attachment img {
	display: block;
	max-width: 220px;
	max-height: 220px;
	object-fit: cover;
}

.ai-tool-status {
	display: flex;
	gap: 9px;
	align-items: center;
	padding: 9px 13px;
	margin-bottom: 10px;
	font-size: 0.83rem;
	color: var(--text-dim);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 99px;
	width: fit-content;
}

.ai-tool-spinner {
	width: 12px;
	height: 12px;
	border: 2px solid var(--accent-line);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: spin 0.7s linear infinite;
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

.ai-action-note {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	margin-top: 10px;
	font-size: 0.78rem;
	color: var(--accent);
	background: var(--accent-soft);
	border: 1px solid var(--accent-line);
	border-radius: 99px;
}

.ai-sources {
	margin-top: 14px;
}

.ai-sources-label {
	margin-bottom: 7px;
	font-size: 0.72rem;
	font-weight: 600;
	color: var(--text-faint);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.ai-sources-list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.ai-source-chip {
	display: flex;
	flex-direction: column;
	gap: 2px;
	max-width: 200px;
	padding: 8px 11px;
	text-decoration: none;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	transition: border-color var(--ease), background var(--ease);
}

.ai-source-chip:hover {
	background: var(--surface-2);
	border-color: var(--accent-line);
}

.ai-source-title {
	overflow: hidden;
	font-size: 0.78rem;
	color: var(--text);
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ai-source-domain {
	overflow: hidden;
	font-size: 0.7rem;
	color: var(--text-faint);
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ai-image-gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 8px;
	max-width: 560px;
	margin: 10px 0;
}

.ai-image-tile {
	display: block;
	aspect-ratio: 1;
	overflow: hidden;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	transition: border-color var(--ease), transform var(--ease);
}

.ai-image-tile:hover {
	border-color: var(--accent-line);
	transform: translateY(-2px);
}

.ai-image-tile img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	background: var(--surface-2);
}

.md-image-link {
	display: inline-block;
}

.md-image {
	display: block;
	max-width: 100%;
	max-height: 360px;
	margin: 8px 0;
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
}

.ai-reasoning {
	margin-bottom: 12px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
}

.ai-reasoning summary {
	padding: 9px 13px;
	font-size: 0.79rem;
	color: var(--text-faint);
	cursor: pointer;
	list-style: none;
}

.ai-reasoning summary::-webkit-details-marker {
	display: none;
}

.ai-reasoning summary::before {
	content: "›";
	display: inline-block;
	margin-right: 7px;
	transition: transform var(--ease);
}

.ai-reasoning[open] summary::before {
	transform: rotate(90deg);
}

.ai-reasoning-text {
	max-height: 210px;
	padding: 0 13px 11px;
	overflow-y: auto;
	font-size: 0.79rem;
	color: var(--text-faint);
	line-height: 1.55;
	white-space: pre-wrap;
}

.ai-thinking {
	display: flex;
	gap: 5px;
	align-items: center;
	height: 24px;
}

.ai-thinking span {
	width: 6px;
	height: 6px;
	background: var(--accent);
	border-radius: 50%;
	animation: pulse 1.2s ease-in-out infinite;
}

.ai-thinking span:nth-child(2) {
	animation-delay: 0.16s;
}

.ai-thinking span:nth-child(3) {
	animation-delay: 0.32s;
}

.ai-input-area {
	flex-shrink: 0;
	padding: 14px 18px 18px;
	border-top: 1px solid var(--border);
}

.ai-attach-tray {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	max-width: 780px;
	margin: 0 auto 10px;
}

.ai-attach-chip {
	position: relative;
	width: 52px;
	height: 52px;
	overflow: hidden;
	border-radius: 10px;
	box-shadow: var(--shadow);
}

.ai-attach-chip img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ai-attach-chip button {
	position: absolute;
	top: 2px;
	right: 2px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 17px;
	height: 17px;
	color: #fff;
	background: rgba(0, 0, 0, 0.6);
	border: none;
	border-radius: 50%;
	cursor: pointer;
}

.ai-input-wrap {
	display: flex;
	gap: 6px;
	align-items: flex-end;
	max-width: 780px;
	padding: 6px 6px 6px 14px;
	margin: 0 auto;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 26px;
	transition: border-color var(--ease);
}

.ai-input-wrap:focus-within {
	border-color: var(--border-strong);
}

.ai-attach-btn {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	margin-bottom: 6px;
	color: var(--text-faint);
	background: none;
	border: none;
	cursor: pointer;
	transition: color var(--ease);
}

.ai-attach-btn:hover {
	color: var(--text);
}

.ai-attach-btn svg {
	width: 19px;
	height: 19px;
}

.ai-input {
	flex: 1;
	max-height: 200px;
	padding: 9px 4px;
	font-family: inherit;
	font-size: 0.89rem;
	line-height: 1.5;
	color: var(--text);
	resize: none;
	background: none;
	border: none;
	outline: none;
}

.ai-input::placeholder {
	color: var(--text-faint);
}

.ai-send,
.ai-stop {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	transition: filter var(--ease), opacity var(--ease);
}

.ai-send {
	color: var(--accent-contrast);
	background: var(--accent);
}

.ai-send:disabled {
	opacity: 0.35;
	cursor: default;
}

.ai-stop {
	color: #f87171;
	background: rgba(248, 113, 113, 0.14);
}

.ai-send:hover:not(:disabled),
.ai-stop:hover {
	filter: brightness(1.1);
}

.ai-send svg,
.ai-stop svg {
	width: 17px;
	height: 17px;
}

.ai-disclaimer {
	max-width: 780px;
	margin: 8px auto 0;
	font-size: 0.7rem;
	color: var(--text-faint);
	text-align: center;
}

.ai-sidebar-toggle {
	display: none;
}



.ai-md > *:first-child {
	margin-top: 0;
}

.ai-md p {
	margin: 0 0 10px;
}

.ai-md p:last-child {
	margin-bottom: 0;
}

.ai-md h1,
.ai-md h2,
.ai-md h3,
.ai-md h4 {
	margin: 18px 0 8px;
	font-weight: 600;
	line-height: 1.3;
}

.ai-md h1 {
	font-size: 1.28rem;
}

.ai-md h2 {
	font-size: 1.12rem;
}

.ai-md h3 {
	font-size: 1rem;
}

.ai-md ul,
.ai-md ol {
	margin: 0 0 10px;
	padding-left: 22px;
}

.ai-md li {
	margin-bottom: 4px;
}

.ai-md a {
	color: var(--accent);
	text-decoration: none;
	border-bottom: 1px solid var(--accent-line);
}

.ai-md a:hover {
	border-bottom-color: var(--accent);
}

.ai-md blockquote {
	margin: 0 0 10px;
	padding: 3px 0 3px 14px;
	color: var(--text-dim);
	border-left: 2px solid var(--accent-line);
}

.ai-md hr {
	margin: 16px 0;
	border: none;
	border-top: 1px solid var(--border);
}

.ai-md code {
	padding: 2px 5px;
	font-family: var(--font-mono);
	font-size: 0.84em;
	color: var(--accent);
	background: var(--surface-2);
	border-radius: 4px;
}

.md-table-wrap {
	margin-bottom: 12px;
	overflow-x: auto;
}

.ai-md table {
	width: 100%;
	font-size: 0.84rem;
	border-collapse: collapse;
}

.ai-md th,
.ai-md td {
	padding: 8px 11px;
	text-align: left;
	border: 1px solid var(--border);
}

.ai-md th {
	font-weight: 600;
	background: var(--surface-2);
}

pre.md-code {
	position: relative;
	margin: 0 0 12px;
	padding: 14px 15px;
	overflow-x: auto;
	font-family: var(--font-mono);
	font-size: 0.81rem;
	line-height: 1.6;
	background: var(--bg-deep);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
}

pre.md-code code {
	padding: 0;
	color: var(--text);
	background: none;
	border-radius: 0;
}

.md-code-copy {
	position: absolute;
	top: 8px;
	right: 8px;
	padding: 3px 9px;
	font-family: inherit;
	font-size: 0.7rem;
	color: var(--text-faint);
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: 5px;
	opacity: 0;
	cursor: pointer;
	transition: all var(--ease);
}

pre.md-code:hover .md-code-copy {
	opacity: 1;
}

.md-code-copy:hover {
	color: var(--accent);
	border-color: var(--accent-line);
}

.md-code-lang {
	position: absolute;
	top: 10px;
	right: 62px;
	font-family: var(--font-mono);
	font-size: 0.66rem;
	color: var(--text-faint);
	pointer-events: none;
}

.tok-comment {
	color: var(--text-faint);
	font-style: italic;
}

.tok-keyword {
	color: var(--accent);
}

.tok-string {
	color: #fbbf24;
}

.tok-number {
	color: #f97316;
}

.tok-function {
	color: #60a5fa;
}

.tok-punct {
	color: var(--text-dim);
}

:root[data-mode="light"] .tok-string {
	color: #b45309;
}

:root[data-mode="light"] .tok-number {
	color: #c2410c;
}

:root[data-mode="light"] .tok-function {
	color: #1d4ed8;
}

:root[data-mode="light"] .tok-keyword {
	color: var(--accent-strong);
}

:root[data-mode="light"] .ai-md code {
	color: var(--accent-strong);
}



.akura-math-inline {
	display: inline-block;
	font-size: 1.02em;
	vertical-align: middle;
}

.akura-math-block {
	display: block;
	margin: 12px 0;
	overflow-x: auto;
	font-size: 1.12em;
	text-align: center;
}

math {
	color: var(--text);
}



.akura-context-menu {
	position: fixed;
	z-index: 500;
	min-width: 200px;
	padding: 5px;
	background: var(--surface);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow-lg);
	animation: dropIn 0.12s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.akura-context-item {
	display: flex;
	gap: 10px;
	align-items: center;
	width: 100%;
	padding: 9px 11px;
	font-family: inherit;
	font-size: 0.83rem;
	color: var(--text-dim);
	text-align: left;
	background: none;
	border: none;
	border-radius: var(--radius-xs);
	cursor: pointer;
}

.akura-context-item:hover:not(:disabled) {
	color: var(--text);
	background: var(--surface-2);
}

.akura-context-item:disabled {
	color: var(--text-faint);
	cursor: default;
}

.akura-context-item svg {
	flex-shrink: 0;
	color: var(--accent);
}

.akura-context-sep {
	height: 1px;
	margin: 5px 4px;
	background: var(--border);
}

.akura-toast {
	position: fixed;
	bottom: 26px;
	left: 50%;
	z-index: 600;
	padding: 9px 16px;
	font-size: 0.82rem;
	color: var(--text);
	background: var(--surface-2);
	border: 1px solid var(--border-strong);
	border-radius: 99px;
	box-shadow: var(--shadow-lg);
	opacity: 0;
	transform: translate(-50%, 6px);
	transition: opacity 0.2s ease, transform 0.2s ease;
	pointer-events: none;
}

.akura-toast.show {
	opacity: 1;
	transform: translate(-50%, 0);
}



@media (max-width: 900px) {
	.settings-layout {
		grid-template-columns: 1fr;
	}

	.settings-rail {
		position: static;
		flex-direction: row;
		overflow-x: auto;
	}

	.rail-item {
		flex-shrink: 0;
	}
}

@media (max-width: 760px) {
	.page {
		padding: 32px 18px 80px;
	}

	.ai-sidebar {
		position: absolute;
		top: 0;
		bottom: 0;
		left: 0;
		z-index: 30;
		transform: translateX(-100%);
		transition: transform var(--ease);
	}

	.ai-sidebar.open {
		transform: none;
		box-shadow: var(--shadow-lg);
	}

	.ai-sidebar-toggle {
		display: flex;
	}

	.theme-grid,
	.mode-grid {
		grid-template-columns: 1fr;
	}

	.setting-row {
		flex-direction: column;
		align-items: flex-start;
		gap: 10px;
	}

	.setting-control .field {
		width: 100%;
	}

	.site-footer {
		right: 0;
		left: 0;
		justify-content: center;
	}
}

@media (max-width: 420px) {
	.quick-grid {
		grid-template-columns: repeat(3, 1fr);
	}

	.games-grid {
		grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

