:root {
	--bg-primary: #ffffff;
	--bg-secondary: #f8f9fa;
	--bg-editor: #ffffff;
	--text-primary: #333333;
	--text-secondary: #666666;
	--border-color: #e1e5e9;
	--accent-color: #4a6cf7;
	--accent-hover: #3a5ce5;
	--toolbar-bg: #f8f9fa;
	--shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
	--editor-shadow: 0 0 0 1px var(--border-color);
	--notification-bg: #4a6cf7;
	--stat-bg: #f0f4ff;
	--toggle-bg: #e1e5e9;
	--knob-color: #ffffff;
	--toggle-border: #ccd0d5;
}

body.dark-mode {
	--bg-primary: #1a1a1a;
	--bg-secondary: #2d2d2d;
	--bg-editor: #2d2d2d;
	--text-primary: #ffffff;
	--text-secondary: #cccccc;
	--border-color: #404040;
	--accent-color: #5d7df7;
	--accent-hover: #6d8dff;
	--toolbar-bg: #2d2d2d;
	--shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
	--editor-shadow: 0 0 0 1px var(--border-color);
	--notification-bg: #5d7df7;
	--stat-bg: #3a3a3a;
	--toggle-bg: #404040;
	--knob-color: #2d2d2d;
	--toggle-border: #555555;
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
	background-color: var(--bg-primary);
	color: var(--text-primary);
	line-height: 1.6;
	transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
	max-width: 800px;
	margin: 0 auto;
	padding: 20px;
}

.header {
	text-align: center;
	margin-bottom: 30px;
	position: relative;
}

.header h1 {
	font-size: 2.5rem;
	margin-bottom: 8px;
	color: var(--text-primary);
}

.header p {
	color: var(--text-secondary);
	font-size: 1.1rem;
}

.theme-toggle {
	position: absolute;
	top: 0;
	right: 0;
	width: 60px;
	height: 30px;
	background: var(--toggle-bg);
	border: 1px solid var(--toggle-border);
	border-radius: 15px;
	cursor: pointer;
	transition: all 0.3s ease;
}

.theme-toggle:hover {
	transform: scale(1.05);
}

.toggle-knob {
	position: absolute;
	top: 2px;
	left: 2px;
	width: 24px;
	height: 24px;
	background: var(--knob-color);
	border-radius: 50%;
	transition: transform 0.3s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.theme-toggle.dark .toggle-knob {
	transform: translateX(30px);
}

.icon {
	font-size: 12px;
	position: absolute;
	transition: opacity 0.3s ease;
	line-height: 1;
}

.sun {
	opacity: 1;
}

.moon {
	opacity: 0;
}

.theme-toggle.dark .sun {
	opacity: 0;
}

.theme-toggle.dark .moon {
	opacity: 1;
}

.toolbar {
	display: flex;
	gap: 10px;
	margin-bottom: 20px;
	padding: 15px;
	background: var(--toolbar-bg);
	border-radius: 12px;
	box-shadow: var(--shadow);
	flex-wrap: wrap;
	justify-content: space-between;
}

.toolbar div {
	display: flex;
	gap: 10px;
	border-radius: 12px;
	flex-wrap: wrap;
}

.btn {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 10px 16px;
	background: var(--bg-primary);
	color: var(--text-primary);
	border: 1px solid var(--border-color);
	border-radius: 8px;
	cursor: pointer;
	font-size: 14px;
	transition: all 0.2s ease;
	position: relative;
}

.btn:hover {
	background: var(--bg-secondary);
	border-color: var(--accent-color);
	transform: translateY(-1px);
}

body:not(.dark-mode) .active .keyboard-hint {
	color: #ffffff !important;
}

.btn-primary, .btn.active {
	background: var(--accent-color);
	color: #ffffff;
	border-color: var(--accent-color);
}

.btn-primary:hover, .btn.active:hover {
	background: var(--accent-hover);
	border-color: var(--accent-hover);
	transform: translateY(-1px);
}

.keyboard-hint {
	font-size: 11px;
	opacity: 0.7;
	color: var(--text-secondary);
}

.editor-container {
	margin-bottom: 20px;
}

#editor {
	min-height: 400px;
	padding: 24px;
	background: var(--bg-editor);
	border: 1px solid var(--border-color);
	border-radius: 12px;
	outline: none;
	color: var(--text-primary);
	font-size: 16px;
	line-height: 1.6;
	box-shadow: var(--editor-shadow);
	transition: all 0.3s ease;
}

#editor:focus {
	border-color: var(--accent-color);
	box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.1);
}

#editor[placeholder]:empty:before {
	content: attr(placeholder);
	color: var(--text-secondary);
	opacity: 0.7;
}

.stats {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 15px 20px;
	background: var(--stat-bg);
	border-radius: 12px;
	box-shadow: var(--shadow);
	flex-wrap: wrap;
	gap: 15px;
}

.stat-item {
	display: flex;
	align-items: center;
	gap: 8px;
	color: var(--text-secondary);
	font-size: 14px;
}

.stat-value {
	font-weight: bold;
	color: var(--text-primary);
	font-size: 16px;
}

.save-status {
	display: flex;
	align-items: center;
	gap: 8px;
	color: var(--text-secondary);
	font-size: 14px;
}

.save-indicator {
	width: 8px;
	height: 8px;
	background: #4CAF50;
	border-radius: 50%;
	animation: pulse 2s infinite;
}

@keyframes pulse {
	0% {
		opacity: 1;
	}

	50% {
		opacity: 0.5;
	}

	100% {
		opacity: 1;
	}
}

.notification {
	position: fixed;
	top: 20px;
	right: 20px;
	padding: 12px 20px;
	background: var(--notification-bg);
	color: #ffffff;
	border-radius: 8px;
	box-shadow: var(--shadow);
	transform: translateX(150%);
	transition: transform 0.3s ease;
	z-index: 1000;
}

.notification.show {
	transform: translateX(0);
}

@media (max-width: 1024px) {
    .container {
        max-width: 95%;
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
        margin-bottom: 10px;
    }
    
    .header p {
        font-size: 1rem;
        margin-bottom: 15px;
    }
}
@media (max-width: 768px) {
    .container {
        padding: 10px;
        max-width: 100%;
    }
    
    .header {
        margin-bottom: 20px;
        padding-top: 10px;
    }
    
    .header h1 {
        font-size: 1.75rem;
        padding-right: 60px;
    }
    
    .header p {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }
    
    .theme-toggle {
        position: absolute;
        top: 17px;
        right: 0;
        width: 50px;
        height: 26px;
    }
    
    .toggle-knob {
        width: 20px;
        height: 20px;
    }
    
    .theme-toggle.dark .toggle-knob {
        transform: translateX(24px);
    }
    
    .toolbar {
        padding: 12px;
        gap: 8px;
        margin-bottom: 15px;
    }
    
    .toolbar div {
        gap: 8px;
        width: 100%;
        justify-content: space-between;
    }
    
    .btn {
        padding: 12px 14px;
        font-size: 13px;
        flex: 1;
        min-width: 0;
        justify-content: center;
    }
    
    .keyboard-hint {
        display: none;
    }
    
    #editor {
        min-height: 100vh;
        padding: 20px;
        font-size: 16px;
        line-height: 1.5;
    }
    
    .stats {
        padding: 12px 15px;
        gap: 12px;
        flex-direction: column;
        text-align: center;
    }
    
    .stat-item {
        justify-content: center;
        width: 100%;
    }
    
    .save-status {
        justify-content: center;
        width: 100%;
        margin-top: 5px;
    }
}

@media (max-width: 480px) {
    .header p {
        font-size: 0.85rem;
    }
    
    .toolbar {
        flex-direction: column;
        gap: 10px;
    }
    
    .toolbar div {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 5px 0px;
    }
    
    .toolbar div::-webkit-scrollbar {
        height: 3px;
    }
    
    .toolbar div::-webkit-scrollbar-thumb {
        background: var(--border-color);
        border-radius: 3px;
    }
    
    .btn {
        padding: 10px 12px;
        font-size: 12px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    #editor {
        padding: 16px;
        font-size: 16px;
    }
    
    .stat-item {
        font-size: 13px;
    }
    
    .stat-value {
        font-size: 14px;
    }
    
    .save-status {
        font-size: 13px;
    }
    
    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        text-align: center;
        transform: translateY(-150%);
    }
    
    .notification.show {
        transform: translateY(0);
    }
}

@media (max-width: 360px) {
    .container {
        padding: 8px;
    }
    
    .btn {
        padding: 8px 10px;
        font-size: 11px;
    }
    
    #editor {
        padding: 12px;
    }
    
    .stats {
        padding: 10px;
    }
}

@media (max-height: 600px) {
    .header {
        margin-bottom: 15px;
    }
    
    .toolbar {
        margin-bottom: 12px;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    .header {
        margin-bottom: 15px;
    }
    
    .toolbar {
        padding: 8px 12px;
    }
    
    .btn {
        padding: 8px 12px;
    }
}

@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
        background: var(--bg-primary);
        border-color: var(--border-color);
    }
    
    .btn-primary:hover {
        transform: none;
        background: var(--accent-color);
        border-color: var(--accent-color);
    }
    
    .theme-toggle:hover {
        transform: none;
    }
    
    .btn {
        min-height: 44px;
    }
    
    .theme-toggle {
        min-width: 44px;
        min-height: 44px;
    }
}