@layer base, components, utilities;

@layer base {
body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    width: 100%;
    background: var(--bg);
    margin: 0;
    color: var(--text);
    background-image: none;
    min-height: 100vh;
    line-height: 1.6;
}

/* Utility: visually hidden */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}


/* Design tokens - Clean, flat theme matching Foundation buttons */
:root {
    /* Flat color system - matching Foundation/Bootstrap aesthetic */
    --bg: #2c3e50; /* Clean slate blue-gray background */
    --surface: #34495e; /* Slightly lighter surface */
    --surface-2: #3d566e;
    --text: #ecf0f1; /* Clean white text */
    --muted: #95a5a6; /* Muted gray text */
    --primary: #3498db; /* Bright blue */
    --secondary: #9b59b6; /* Purple */
    --accent: #1abc9c; /* Turquoise */
    --accent-2: #e74c3c; /* Red accent */
    --success: #2ecc71; /* Green */
    --warning: #f39c12; /* Orange */
    --danger: #e74c3c; /* Red */
    --elev-1: 0 2px 4px rgba(0,0,0,0.2);
    --elev-2: 0 4px 8px rgba(0,0,0,0.3);
    /* Simple transitions */
    --ease-hover: ease;
    --dur-hover: 0.2s;
    --dur-press: 0.1s;
    --dur-panel: 0.3s;
}

html::-webkit-scrollbar {
	width: 0px;
	background-color: transparent;
}
/* Accessible skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: #111827;
  color: #fff;
  padding: 10px 14px;
  border-radius: 0;
  z-index: 100000;
}
.skip-link:focus { left: 12px; top: 12px; box-shadow: 0 4px 12px rgba(0,0,0,.3); }
}

.textarea-input::-webkit-scrollbar {
	width: 6px;
}

.textarea-input::-webkit-scrollbar-track {
	background: transparent;
}

.textarea-input::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.5);
	border-radius: 0;
}

.textarea-input::-webkit-scrollbar-thumb:hover {
	background: rgba(255, 255, 255, 1);
}

.textarea-input {
    font-family: inherit;
	-webkit-font-smoothing: antialiased;
	width: 100%;
	border-radius: 0;
	resize: vertical;
	margin-top: 16px; /* 8px grid */
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.12);
	padding: 16px; /* 8px grid */
    margin-bottom: 16px; /* 8px grid */
	transition: all 0.3s ease;
	font-size: 14px;
	line-height: 1.6;
}

.textarea-input:focus {
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.65);
    box-shadow: 0 0 0 3px rgba(59,130,246,.45);
}

.textarea-container {
	position: relative;
	width: 100%;
	max-width: 1500px;
	margin: 0 auto;
}

.textarea-input {
	width: 100%;
	padding-left: 50px;
	height: 150px;
	font-size: 11px;
}

.textarea-input::placeholder {
	color: rgba(255, 255, 255, 0.7);
}

.textarea-container,
.input-group input {
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.generated {
	display: inline;
	position: relative;
	padding: 0.1em 0.2em 0.1em 0.2em;
	white-space: pre-line;
	word-wrap: break-word;
	line-height: 1.3;
	background-color: transparent;
	color: #fff;
	-webkit-box-decoration-break: clone;
	box-decoration-break: clone;
	border-radius: 0;
	background-clip: padding-box;
	margin-bottom: 2px;
	z-index: 1;
}

.background-active {
	background-color: rgb(0, 0, 0);
	padding: 10px;
}

#output {
	position: relative;
    padding-bottom: 24px; /* 8px grid */
	border-radius: 0;
	background-color: transparent;
	box-sizing: border-box;
	overflow: visible;
    max-width: 1100px;
    margin: 24px auto 0; /* 8px grid */
}

/* Attention animation for Buy Me a Coffee button */
.bmc-btn { display: inline-block; }
.bmc-attn { animation: bmcShake 600ms var(--ease-spring); }
@keyframes bmcShake {
  0% { transform: translateX(0); }
  10% { transform: translateX(-3px); }
  20% { transform: translateX(3px); }
  30% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  50% { transform: translateX(-2px); }
  60% { transform: translateX(2px); }
  70% { transform: translateX(-1px); }
  80% { transform: translateX(1px); }
  100% { transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce){
  .bmc-attn { animation: none; }
}

.me {
	color: #c2a3da;
}

.ame {
	color: #c2a3da;
}

.darkgrey {
	color: #5a5a5b;
}

.grey {
	color: #939799;
}

.lightgrey {
	color: #c6c4c4
}

.death {
	color: #f00000;
}

.yellow {
	color: #fbf724;
}

.green,
.money {
	color: #56d64b;
}

.orange,
.whisper {
	color: #eda841;
}

.blue {
	color: #3896f3;
}

.white {
	color: #f1f1f1;
}

.radioColor {
	color: #D6CF8C;
}

.radioColor2 {
	color: #a19558;
}

.depColor {
	color: #ccca15;
}

.vesseltraffic {
	color: #33C1C9;
}

.toyou {
	color: #ff00bc;
}

.output {
	line-height: 1.45; /* Default line-height, adjusted by size classes */
	font-family: Arial, sans-serif !important;
	-webkit-font-smoothing: none !important;
	-moz-osx-font-smoothing: none !important;
	text-rendering: optimizeSpeed;
	font-weight: 700;
	color: #fff;
	/* Fill all 8 directions to avoid tiny gaps in the faux stroke */
	text-shadow:
	  0 1px 0 #000,
	  0 -1px 0 #000,
	  1px 0 0 #000,
	 -1px 0 0 #000,
	 -1px -1px 0 #000,
	  1px -1px 0 #000,
	 -1px 1px 0 #000,
	  1px 1px 0 #000;
	letter-spacing: 0.2px;
	font-size: 12px;
	margin-top: 20px;
	padding: 20px;
    /* Slightly lighter surface so new line breaks are easier to see even with black text background */
    background-color: rgba(24, 32, 44, 0.6);
	border-radius: 0;
	-webkit-backdrop-filter: blur(5px);
	backdrop-filter: blur(5px);
	transition: all var(--dur-panel) var(--ease-spring);
}


/* Size-aware line-height adjustments for optical comfort */
.output.is-small {
	line-height: 1.5; /* More breathing room for small text */
}

.output.is-large {
	line-height: 1.35; /* Tighter for large text */
}

/* Enable font smoothing for smaller font sizes (13px and below) to make them appear more rounded */
.output.font-smoothed {
	-webkit-font-smoothing: antialiased !important;
	-moz-osx-font-smoothing: auto !important;
	text-rendering: optimizeLegibility;
	/* Additional properties to improve font rendering at small sizes */
	font-variant-ligatures: normal;
	-webkit-font-feature-settings: "kern" 1;
	font-feature-settings: "kern" 1;
	/* Ensure consistent rendering across browsers */
	-webkit-text-stroke: 0.01em transparent;
}

/* Use multi-direction text-shadow only to keep outline outside the fill */

.output.processing {
	opacity: 0.8;
	transform: scale(0.99);
}

.auto-save-indicator {
	position: fixed;
	top: 20px;
	right: 20px;
	background: var(--gradient-primary);
	color: white;
	padding: 12px 20px; /* 8px grid */
	border-radius: 0;
	font-size: 14px;
	font-weight: 500;
	z-index: 10000;
	box-shadow: var(--elev-2), 0 0 20px rgba(59, 130, 246, 0.3);
	animation: slideInRight 0.3s ease-out;
	backdrop-filter: blur(10px);
	border: 1px solid rgba(255, 255, 255, 0.1);
    display: none !important; /* Fully hide auto-save indicator */
}

.auto-save-indicator .loading-text { display: none !important; }

/* Loading overlay extracted from inline styles */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loading-dialog {
  background-color: var(--surface);
  padding: 22px 26px;
  border-radius: 0;
  text-align: center;
  box-shadow: var(--elev-2);
  border: 1px solid rgba(0, 0, 0, 0.2);
}

/* New loader design */
.loading-dialog .spinner {
  width: fit-content;
  font-weight: bold;
  font-family: sans-serif;
  font-size: 30px;
  color: var(--text);
  padding-bottom: 8px;
  margin: 0 auto;
  background: linear-gradient(currentColor 0 0) 0 100%/0% 3px no-repeat;
  animation: l2 2s linear infinite;
}

.loading-dialog .spinner:before {
  content: "Loading...";
}

.loading-dialog .loading-text {
  display: none !important;
}

@keyframes l2 {
  to { background-size: 100% 3px; }
}

@keyframes slideInRight {
	from {
		transform: translateX(100%);
		opacity: 0;
	}
	to {
		transform: translateX(0);
		opacity: 1;
	}
}

* {
	-webkit-font-smoothing: none !important;
	-moz-osx-font-smoothing: none !important;
}

/* Moved from inline <style> in index.html */
label { display: none; }
::-webkit-input-placeholder { color: black; }
:-ms-input-placeholder { color: black; }
::placeholder { color: black; }
#chatlogInput::placeholder { color: transparent; }
.button .bmc-btn, .bmc-btn {
  background-color: transparent !important;
  min-width: auto !important;
  height: 38px !important;
  padding: 0 12px !important;
  line-height: 1 !important;
}

@layer components {
/* Foundation-style blocky buttons with ARIA-friendly colors */
.button {
    padding: 0.85em 1em;
    margin: 0;
    font-size: 0.9rem;
    font-weight: bold;
    line-height: 1;
    text-align: center;
    border-radius: 0; /* Blocky style - no rounded corners */
    background-color: #6c757d; /* Default gray - neutral actions */
    color: #ffffff;
    border: none;
    cursor: pointer;
    transition: background-color 0.25s ease-out, color 0.25s ease-out;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    vertical-align: middle;
    appearance: none;
    -webkit-appearance: none;
}

.button:hover,
.button:focus {
    background-color: #5a6268; /* Darker gray on hover */
    color: #ffffff;
}

.button:focus {
    outline: 2px solid rgba(59, 130, 246, 0.45);
    outline-offset: 2px;
}

.button:active {
    transform: none;
}

/* SUCCESS - Green (Download, Positive actions) */
.button.success {
    background-color: #28a745; /* ARIA-friendly green */
    color: #ffffff;
}
.button.success:hover,
.button.success:focus {
    background-color: #218838; /* Darker green on hover */
}

/* WARNING - Yellow/Orange (Toggle, Caution actions) */
.button.warning {
    background-color: #ffc107; /* ARIA-friendly yellow */
    color: #212529; /* Dark text for contrast */
}
.button.warning:hover,
.button.warning:focus {
    background-color: #e0a800; /* Darker yellow on hover */
    color: #212529;
}

/* ALERT/DANGER - Red (Delete, Destructive actions) */
.button.alert,
.button.danger {
    background-color: #dc3545; /* ARIA-friendly red */
    color: #ffffff;
}
.button.alert:hover,
.button.alert:focus,
.button.danger:hover,
.button.danger:focus {
    background-color: #c82333; /* Darker red on hover */
}

/* INFO/PRIMARY - Blue (Mode toggles, Information) */
.button.info,
.button.primary {
    background-color: #007bff; /* ARIA-friendly blue */
    color: #ffffff;
}
.button.info:hover,
.button.info:focus,
.button.primary:hover,
.button.primary:focus {
    background-color: #0056b3; /* Darker blue on hover */
}

/* SECONDARY - Light gray (Secondary actions) */
.button.secondary {
    background-color: #868e96; /* Light gray */
    color: #ffffff;
}
.button.secondary:hover,
.button.secondary:focus {
    background-color: #6c757d; /* Darker gray on hover */
}

/* ACTIVE state - Brighter version of primary */
.button.active {
    background-color: #0056b3; /* Active blue */
    color: #ffffff;
    box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
}
.button.active:hover,
.button.active:focus {
    background-color: #004085; /* Even darker blue */
}

.button:disabled,
.button[disabled] {
    opacity: 0.65;
    cursor: not-allowed;
    background-color: #6c757d;
}

/* Small button variant */
.button.small {
    padding: 0.65em 0.85em;
    font-size: 0.8rem;
    height: 38px;
}

/* Button group - ensures buttons are grouped together */
.button-group {
    display: flex;
    flex-wrap: nowrap; /* Keep all buttons on one line */
    align-items: stretch;
    gap: 0.25rem; /* Small gap between buttons */
    margin-bottom: 1rem;
    overflow-x: auto; /* Allow horizontal scrolling if needed on small screens */
}

.button-group .button,
.button-group > div.button,
.button-group a.button {
    margin: 0 !important;
    border-radius: 0 !important;
    height: 44px !important; /* Consistent height for all buttons */
    flex-shrink: 0;
    padding: 0.85em 1em !important; /* Override any button-specific padding */
    font-size: 0.9rem !important; /* Ensure consistent font size */
    line-height: 1 !important;
    text-decoration: none !important; /* For anchor tags */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Hidden button/control state - must override button-group display */
.button-group .button.button-hidden,
.button-group > div.button.button-hidden {
    display: none !important;
}

/* Overlay controls within button-group */
.button-group .overlay-control {
    flex-shrink: 0;
    gap: 4px;
}

.button-group .overlay-control input[type="number"] {
    background: transparent !important;
    border: none !important;
    color: inherit !important;
    font-size: inherit !important;
    text-align: center !important;
    padding: 2px 4px !important;
    margin: 0 !important;
    height: auto !important;
    box-shadow: none !important;
}

.button-group .overlay-control input[type="number"]:focus {
    outline: 1px solid rgba(255, 255, 255, 0.3) !important;
    outline-offset: -1px !important;
}

.input-group {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin-bottom: 8px;
}

.input-group-button {
    display: flex;
    gap: 0.25rem; /* Match button-group spacing */
}

.input-group-button .button,
.input-group-button .button.small {
    border-radius: 0 !important; /* Blocky style to match other buttons */
    margin: 0 !important;
    padding: 0.65em 0.85em !important;
    font-size: 0.8rem !important;
    font-weight: bold !important;
    height: 38px !important;
    line-height: 1 !important;
}

.input-group input,
.cell input {
    padding: 12px 16px;
    border-radius: 0 !important;
    flex: 1;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background-color: rgba(255, 255, 255, 0.08);
    box-sizing: border-box;
    font-size: 14px;
    height: 44px; /* Match button height */
    margin-bottom: 0;
    transition: all 0.3s ease;
    color: var(--text);
    font-family: inherit;
}


.input-group input::placeholder,
.cell input::placeholder {
	color: rgba(255, 255, 255, 0.7);
}

.golden-sizes-hint {
	display: none;
}


.input-group input:hover,
.cell input:hover {
    border-color: rgba(59, 130, 246, 0.35);
    background-color: rgba(255, 255, 255, 0.12);
}

.input-group input:focus,
.cell input:focus {
    border-color: rgba(59,130,246,0.65);
    background-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 3px rgba(59,130,246,.45);
    color: #fff;
    outline: none;
}

.input-group input:-webkit-autofill,
.cell input:-webkit-autofill {
	-webkit-text-fill-color: #fff !important;
	-webkit-box-shadow: 0 0 0 30px rgba(255, 255, 255, 0.08) inset !important;
	transition: background-color 5000s ease-in-out 0s;
}

.input-group-button .button {
    padding: 0 12px;
    font-size: 13px;
    border-radius: 0 !important;
    background-color: rgba(255,255,255,0.06);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.14);
    cursor: pointer;
    height: 44px;
    margin-bottom: 0;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
    position: relative;
    overflow: hidden;
    font-weight: 500;
}
.grid-x.align-bottom { align-items: flex-end; }

.input-group-button .button::before { content: none; }

.input-group-button .button:hover {
    background-color: #3d3d3d;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.22);
    border-color: rgba(59, 130, 246, 0.35);
}



.input-group-button .button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.button,
.input-group input {
	transition: background-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}



.cell label {
	font-weight: bold;
	font-size: 14px;
	margin-bottom: 0;
}

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

.scale-toggle .switch-input {
	appearance: none;
	width: 50px;
	height: 25px;
	background-color: #111;
	border-radius: 25px;
	position: relative;
	cursor: pointer;
	outline: none;
	transition: background-color 0.3s ease;
}

.scale-toggle .switch-input:checked {
	background-color: #333;
}

.scale-toggle .switch-input::before {
	content: '';
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	background-color: #fff;
	border-radius: 50%;
	transition: transform 0.3s ease;
}

.scale-toggle .switch-input:checked::before {
	transform: translateX(25px);
}

.grid-container {
    padding: 24px; /* 8px grid */
    max-width: 1200px;
    margin: 0 auto;
    background-color: transparent;
    border-radius: 0;
    box-shadow: none;
    /* Enable container queries for context-aware components */
    container-type: inline-size;
}

/* Controls row - clean flat background */
.controls-glass {
    position: relative;
    background-color: var(--surface);
    border-radius: 0;
    padding: 12px 14px;
    box-shadow: var(--elev-1);
    border: 1px solid rgba(0, 0, 0, 0.2);
    margin-bottom: 16px;
}

/* Actions bar glass */
/* .actions-glass removed per design feedback */

/* Textarea glass frame (does not affect content) */
/* .glass-frame removed per design feedback */

/* History tab - blocky button style */
.history-tab {
    background-color: #6c757d; /* Gray - neutral/utility */
    color: #ffffff;
    border: none;
}

.history-tab:hover {
    background-color: #868e96; /* Lighter gray on hover */
}

/* Color palette panel - clean flat style */
#colorPalette {
    background-color: var(--surface);
    border: 1px solid rgba(0, 0, 0, 0.2);
    box-shadow: var(--elev-2);
}

@media (max-width: 640px) {
  :root { --glass-blur: 6px; }
  .controls-glass { padding: 10px 12px; }
}

/* Container queries: adapt controls when the container is narrow */
@container (max-width: 640px) {
  .grid-x.align-center > .cell { margin-bottom: 8px; }
  .input-group { flex-wrap: wrap; gap: 6px; }
  .input-group-button { width: 100%; justify-content: flex-start; }
}

/* Panel-specific container adaptations */
@container (max-width: 420px) {
  .history-header { padding: 12px 14px; }
  .history-header h3 { font-size: clamp(1rem, 5vw, 1.25rem); }
}

/* Fallback removed - using solid backgrounds now */

.input-cell {
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.input-cell label {
	font-weight: bold;
	font-size: 14px;
}

.input-cell input {
	padding: 0.5rem;
	border: 1px solid #ccc;
	border-radius: 0;
	font-size: 14px;
	box-sizing: border-box;
	margin-bottom: 0;
}

/* Legacy .logo-overlay removed from textarea to avoid blur; keep selectors harmless */
.logo-overlay { display: none !important; }
.logo-overlay img { display: none !important; }



.grid-x {
	display: flex;
	flex-wrap: wrap;
}

.grid-x.grid-margin-x {
	margin-left: -0.625rem;
	margin-right: -0.625rem;
}

.grid-x.grid-margin-x > .cell {
	padding-left: 0.625rem;
	padding-right: 0.625rem;
}

.button-group-container {
	display: flex;
	align-items: center;
	gap: 16px; /* 8px grid */
}

.clear {
	clear: both;
}

.coloring-mode span {
	cursor: pointer;
}

.coloring-mode span:hover {
	outline: 1px dotted rgba(255, 255, 255, 0.5);
}

.selected-for-coloring {
	background-color: rgba(255, 255, 255, 0.2) !important;
	outline: 2px solid #3896f3 !important;
}

.colorable {
	display: inline;
}

/* Removed styling for .colorable.unrecognized to prevent different appearance */

.coloring-mode .colorable:hover {
	background-color: rgba(255, 255, 255, 0.1);
	outline: 1px dotted #3896f3;
}

.pixelated {
	filter: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg'><filter id='pixelate-filter'><feOffset dx='0' dy='0' result='box-blur'/><feFlood x='1' y='1' height='1' width='1'/><feComposite width='3' height='3'/><feTile result='tiles'/><feComposite in='box-blur' operator='in'/><feMorphology operator='dilate' radius='1'/></filter></svg>#pixelate-filter");
}

.hidden {
	opacity: 0;
}

/* Censored content - blur mode */
.censored-content.blur-mode {
	opacity: 1 !important;
	filter: blur(4px);
	-webkit-filter: blur(4px);
	user-select: none;
	pointer-events: none;
}

/* Output font styles for Trebuchet MS */
.output.font-trebuchet {
	font-family: 'Trebuchet MS', 'Lucida Grande', 'Lucida Sans Unicode', sans-serif !important;
}

/* History items should also respect font choice */
.history-item-text.font-trebuchet {
	font-family: 'Trebuchet MS', 'Lucida Grande', 'Lucida Sans Unicode', sans-serif !important;
}

.info-bracket {
	display: inline-block;
	align-items: center;
	justify-content: center;
	padding: 0.7em 1.2em;
	margin: 0 0 1rem 0;
	border-radius: 0.5rem;
	color: #fff;
	font-size: 0.9rem;
	font-weight: bold;
	border: 1px solid transparent;
	background-color: #2d2d2d;
	cursor: pointer;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	text-align: center;
	vertical-align: middle;
	line-height: 1;
	position: relative;
	overflow: hidden;
}

.info-bracket::before { content: none; }

.info-bracket:hover {
    background-color: #3d3d3d;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.22);
    transform: translateY(-2px);
}



.info-bracket:focus {
    outline: 2px solid rgba(59, 130, 246, 0.45);
    outline-offset: 2px;
}

.info-bracket:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.info-icon {
	margin-right: 2px;
}

.censor-char-container {
	display: inline-block;
	vertical-align: middle;
	margin: 0 0.25rem;
}

.censor-char-display {
	width: 2.5rem;
	height: 2.4rem;
	text-align: center;
	font-size: 1.2rem;
	border: 1px solid #cacaca;
	border-radius: 0;
	background-color: #e6e6e6;
	cursor: pointer;
	padding: 0.5rem 0;
	margin: 0;
	font-weight: bold;
	vertical-align: middle;
	line-height: 1.25;
	display: inline-block;
}

.censor-char-display:hover {
	background-color: #d0d0d0;
}

.censor-char-display:focus {
	outline: none;
}

.censor-char-button {
	min-width: 44px !important;
	font-size: 1.25rem !important;
	font-weight: bold !important;
}

/* Icon-only buttons */
.button.icon-btn {
	min-width: 44px;
	padding: 0.85em !important;
	aspect-ratio: 1;
}

.button.icon-btn i {
	font-size: 1rem;
}

/* Active state for toggle icon buttons - brighter with ring */
.button.icon-btn.active {
	box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.button.warning.icon-btn.active {
	background-color: #e0a800;
	box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 0 2px rgba(255, 193, 7, 0.5);
}

.button.secondary.icon-btn.active {
	background-color: #5a6268;
	box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 0 2px rgba(108, 117, 125, 0.5);
}

.history-dropdown {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	max-height: 300px;
	overflow-y: auto;
	background: white;
	border: 1px solid #ccc;
	border-radius: 0;
	box-shadow: 0 2px 10px rgba(0,0,0,0.1);
	z-index: 100;
	display: none;
}

.history-panel .history-header {
    box-sizing: border-box !important;
    padding: 20px 24px !important; /* 8px grid */
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    background: var(--surface) !important; /* Match website surface color */
    color: var(--text) !important;
    flex-shrink: 0 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.history-panel .history-header h3 {
    margin: 0 !important;
    font-size: clamp(1.125rem, 3.5vw, 1.5rem) !important;
    font-weight: 600 !important;
    color: var(--text) !important;
    text-wrap: balance !important;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.history-panel .history-items {
	flex: 1 !important;
	overflow-y: auto !important;
	padding: 20px 24px !important; /* 8px grid */
	scrollbar-width: thin !important;
	scrollbar-color: rgba(255, 255, 255, 0.3) transparent !important;
	gap: 16px !important; /* 8px grid */
	display: flex !important;
	flex-direction: column !important;
	background: var(--bg) !important; /* Match website background */
}

.history-items::-webkit-scrollbar {
	width: 8px;
}

.history-items::-webkit-scrollbar-track {
	background: transparent;
}

.history-items::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.3);
	border-radius: 0;
}

.history-items::-webkit-scrollbar-thumb:hover {
	background: rgba(255, 255, 255, 0.5);
}

.history-panel .history-item {
	padding: 16px 20px !important; /* 8px grid */
	cursor: pointer !important;
	border: 1px solid rgba(0, 0, 0, 0.2) !important;
	border-radius: 0 !important; /* Blocky style */
	background: var(--surface-2) !important;
	color: var(--text) !important;
	transition: all var(--dur-hover) var(--ease-hover) !important;
	box-shadow: var(--elev-1) !important;
	max-height: 200px !important;
	overflow-y: auto !important;
	position: relative !important;
}

/* Liquid glass wrapper - ensure it inherits history-item styling */
.history-panel .history-item.liquidGlass-wrapper {
	padding: 16px 20px !important;
	background: var(--surface-2) !important;
	border: 1px solid rgba(0, 0, 0, 0.2) !important;
	border-radius: 0 !important;
	box-shadow: var(--elev-1) !important;
	position: relative !important;
	overflow: hidden !important;
}

/* Hide liquid glass effects - we're using flat design */
.history-panel .history-item .liquidGlass-effect,
.history-panel .history-item .liquidGlass-tint,
.history-panel .history-item .liquidGlass-shine {
	display: none !important;
}

/* Ensure text container is properly positioned */
.history-panel .history-item .liquidGlass-text {
	position: relative !important;
	z-index: 1 !important;
	width: 100% !important;
}

.history-panel .history-item:hover {
    background: rgba(255,255,255,0.08) !important;
    border-color: rgba(255,255,255,0.2) !important;
    box-shadow: var(--elev-2) !important;
	transform: translateY(-1px) !important;
}

.history-panel .history-item.liquidGlass-wrapper:hover {
	background: rgba(255,255,255,0.08) !important;
	border-color: rgba(255,255,255,0.2) !important;
	box-shadow: var(--elev-2) !important;
	transform: translateY(-1px) !important;
}

.history-item:focus-visible {
	outline: 2px solid var(--primary);
	outline-offset: 2px;
	border-radius: 0;
}

.history-item-text {
	/* Match output styling exactly */
	font-family: Arial, sans-serif !important;
	font-weight: 700;
	font-size: 12px;
	line-height: 1.45;
	color: #fff; /* Base color, but color classes will override */
	/* 8-direction text-shadow to match output black outline */
	text-shadow:
		0 1px 0 #000,
		0 -1px 0 #000,
		1px 0 0 #000,
		-1px 0 0 #000,
		-1px -1px 0 #000,
		1px -1px 0 #000,
		-1px 1px 0 #000,
		1px 1px 0 #000;
	letter-spacing: 0.2px;
	/* Font rendering to match output */
	-webkit-font-smoothing: none !important;
	-moz-osx-font-smoothing: none !important;
	text-rendering: optimizeSpeed;
	/* Word wrapping */
	word-wrap: break-word;
	overflow-wrap: break-word;
	white-space: pre-line;
	margin: 0;
	padding: 0;
}

/* Ensure color classes in history items override base color and are preserved */
.history-panel .history-item-text .me,
.history-panel .history-item-text .ame { color: #c2a3da !important; }
.history-panel .history-item-text .darkgrey { color: #5a5a5b !important; }
.history-panel .history-item-text .grey { color: #939799 !important; }
.history-panel .history-item-text .lightgrey { color: #c6c4c4 !important; }
.history-panel .history-item-text .death { color: #f00000 !important; }
.history-panel .history-item-text .yellow { color: #fbf724 !important; }
.history-panel .history-item-text .green { color: #56d64b !important; }
.history-panel .history-item-text .orange { color: #eda841 !important; }
.history-panel .history-item-text .blue { color: #3896f3 !important; }
.history-panel .history-item-text .white { color: #f1f1f1 !important; }
.history-panel .history-item-text .radioColor { color: #ffec8b !important; }
.history-panel .history-item-text .radioColor2 { color: #a19558 !important; }
.history-panel .history-item-text .depColor { color: #ccca15 !important; }
.history-panel .history-item-text .vesseltraffic { color: #33C1C9 !important; }
.history-panel .history-item-text .toyou { color: #ff00bc !important; }

/* Style line breaks - they should preserve spacing */
.history-item-text br {
	display: block;
	line-height: 1.45;
}

.history-item-text .me { color: #c2a3da; }
.history-item-text .ame { color: #c2a3da; }
.history-item-text .darkgrey { color: #5a5a5b; }
.history-item-text .grey { color: #939799; }
.history-item-text .lightgrey { color: #c6c4c4; }
.history-item-text .death { color: #f00000; }
.history-item-text .yellow { color: #fbf724; }
.history-item-text .green { color: #56d64b; }
.history-item-text .orange { color: #eda841; }
.history-item-text .blue { color: #3896f3; }
.history-item-text .white { color: #f1f1f1; }
.history-item-text .radioColor { color: #ffec8b; }
.history-item-text .radioColor2 { color: #a19558; }
.history-item-text .depColor { color: #ccca15; }
.history-item-text .vesseltraffic { color: #33C1C9; }
.history-item-text .toyou { color: #ff00bc; }

/* Nesting-friendly override for future maintainability (modern browsers) */
.history-item-text {
  & .me, & .ame { color: #c2a3da; }
  & .darkgrey { color: #5a5a5b; }
  & .grey { color: #939799; }
  & .lightgrey { color: #c6c4c4; }
  & .death { color: #f00000; }
  & .yellow { color: #fbf724; }
  & .green { color: #56d64b; }
  & .orange { color: #eda841; }
  & .blue { color: #3896f3; }
  & .white { color: #f1f1f1; }
  & .radioColor { color: #ffec8b; }
  & .radioColor2 { color: #a19558; }
  & .depColor { color: #ccca15; }
  & .vesseltraffic { color: #33C1C9; }
  & .toyou { color: #ff00bc; }
}

.history-loading {
	display: none;
	text-align: center;
	padding: 48px 24px; /* 8px grid */
	flex: 1;
	justify-content: center;
	align-items: center;
	background: var(--bg) !important; /* Match website background */
}

.history-loading.active {
	display: flex;
}

/* Loader for history panel */
.history-loading .spinner {
  width: fit-content;
  font-weight: 600;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  color: var(--text);
  padding-bottom: 6px;
  background: linear-gradient(currentColor 0 0) 0 100%/0% 3px no-repeat;
  animation: l2 2s linear infinite;
}

.history-loading .spinner:before {
  content: "Loading...";
}

.history-loading p {
  display: none;
}

.history-empty {
	display: none;
	text-align: center;
	padding: 48px 24px; /* 8px grid */
	color: var(--muted);
	font-size: 14px;
	line-height: 1.6;
	flex: 1;
	justify-content: center;
	align-items: center;
	background: var(--bg) !important; /* Match website background */
	font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.history-empty.active {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.history-empty::before {
	content: "📝";
	font-size: 48px;
	opacity: 0.4;
	margin-bottom: 12px;
	display: block;
}

.history-empty p {
	margin: 0;
	font-weight: 500;
	color: var(--text);
	font-size: 15px;
}

.history-empty p:last-child {
	font-size: 13px;
	color: var(--muted);
	font-weight: 400;
	opacity: 0.8;
}


.close-btn {
	display: none;
}

.clear-history-btn {
    /* Apply blocky button style with alert color (Red = Delete/Clear) - matches .button.alert */
    background-color: #dc3545 !important; /* ARIA-friendly red - matches site buttons */
    color: #ffffff !important;
    border: none !important;
    border-radius: 0 !important; /* Blocky style to match site */
    font-size: 0.8rem !important;
    font-weight: bold !important; /* Match site button font-weight */
    padding: 0.5em 0.875em !important;
    height: auto !important;
    line-height: 1 !important;
    cursor: pointer !important;
    transition: background-color 0.25s ease-out, box-shadow 0.25s ease-out !important;
    margin-left: 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    box-shadow: var(--elev-1) !important;
}

.clear-history-btn:hover {
    background-color: #c82333 !important; /* Darker red on hover - matches .button.alert:hover */
    box-shadow: var(--elev-2) !important;
}
.clear-history-btn:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.45) !important;
    outline-offset: 2px !important;
}

.history-tab {
	position: fixed;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	width: 44px;
	height: 88px;
	background-color: #6c757d; /* Gray - neutral/utility action */
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 0; /* Blocky style */
	cursor: pointer;
	z-index: 1001;
	transition: background-color 0.25s ease-out;
	border: none;
	opacity: 1;
	pointer-events: auto;
}

.history-tab:hover {
    background-color: #868e96; /* Lighter gray on hover */
}

.history-tab:focus {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.history-tab i {
	font-size: 20px;
}

.history-panel {
    position: fixed;
    top: 0;
    right: -350px;
    width: 350px;
    height: 100vh;
    container-type: inline-size;
    background-color: var(--bg) !important; /* Match website background */
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
    transition: right var(--dur-panel) ease;
    z-index: 1000;
    display: flex !important;
    flex-direction: column;
    border-left: 1px solid rgba(0, 0, 0, 0.3);
    overflow: hidden;
}
@media (prefers-reduced-motion: reduce) {
  .history-panel { transition: none; }
}

.history-panel.open {
	right: 0;
	display: flex !important;
}

.history-tab.hidden {
	opacity: 0;
	transform: translateY(-50%) scale(0.8);
	z-index: -1;
}

.character-dropdown {
    background-color: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
    box-shadow: var(--elev-2);
}


.character-dropdown div {
    color: #fff;
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform .15s ease, box-shadow .2s ease;
    border-radius: 0; /* Blocky style */
}

.character-dropdown div:hover {
    background-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 18px rgba(0,0,0,.22);
    transform: translateY(-1px);
}

::-webkit-scrollbar {
	width: 8px;
}

::-webkit-scrollbar-track {
	background: rgba(255, 255, 255, 0.05);
	border-radius: 0;
}

::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.2);
	border-radius: 0;
	transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Removed duplicate .history-header rules - using .history-panel .history-header above for better specificity */
}