* {
  box-sizing:border-box;
  margin:0;
  padding:0;
}
body {
  width:400px;
  margin:0;
  padding:0;
  color:var(--text-primary);
  background-color:var(--background) !important;
  font-family:"Montserrat",serif;
  font-size:14px;
}
* {
  scrollbar-width:none;
  -ms-overflow-style:none;
}
*::-webkit-scrollbar {
  display:none;
}
.popup-container {
  padding:16px;
}
.popup-header {
  text-align:center;
  margin-bottom:16px;
}
.logo-text {
  color:var(--text-primary);
  font-size:20px;
  font-weight:600;
  margin:8px 0;
  display:flex;
  align-items:center;
  justify-content:center;
}
.logo {
  width:20px;
  border-radius:6px;
  margin-right:8px;
}
.settings-card,.about-card,.support-card {
  background:var(--card-card);
  border-radius:16px;
  padding:16px;
  margin-bottom:16px;
  box-shadow:0px 1px var(--shadow-blur) 0px var(--accent-shadow);
}
h2 {
  font-size:16px;
  font-weight:600;
  color:var(--text-primary);
  margin-bottom:12px;
  background-color:var(--card-card);
}
.settings-group {
  display:flex;
  flex-direction:column;
  gap:16px;
}
.setting-section {
  display:flex;
  flex-direction:column;
  gap:12px;
}
.setting-header {
  display:flex;
  align-items:center;
  gap:8px;
  font-weight:600;
  font-size:16px;
  color:var(--text-primary);
}
.theme-grid,.language-grid {
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:12px;
}
.theme-option,.language-option {
  background:none;
  border:none;
  padding:0;
  cursor:pointer;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
  transition:transform 0.2s ease;
}
.theme-option:hover,.language-option:hover {
  transform:translateY(-2px);
}
.theme-option.active .theme-preview {
  outline:2px solid var(--accent-accent);
  outline-offset:2px;
}
.language-option.active .language-preview {
  outline:2px solid var(--accent-accent);
  outline-offset:2px;
}
.theme-preview {
  width:100%;
  height:100px;
  border-radius:8px;
  overflow:hidden;
  position:relative;
}
.theme-option.disabled {
  opacity:0.5;
  cursor:not-allowed;
  position:relative;
}
.theme-option.disabled::after {
  content:"";
  position:absolute;
  top:0;
  left:0;
  width:100%;
  height:100%;
  background-color:rgba(0,0,0,0.1);
  border-radius:8px;
}
.language-option {
  background:var(--card-card);
  border:1px solid var(--border-border);
  border-radius:8px;
  padding:12px;
  transition:all 0.2s ease;
}
.language-option:hover {
  background:var(--card-hover);
  border-color:var(--accent-accent);
}
.language-option.active {
  background:var(--accent-accent);
  border-color:var(--accent-accent);
  color:white;
}
.language-name {
  color:var(--text-primary);
  font-size:12px;
  font-weight:500;
  font-family: "Montserrat", serif;
}

.theme-preview.light-green {
  background:#FAFFF0;
}
.theme-preview.light-green .preview-header {
  background:#F3FBDE;
}
.theme-preview.light-green .preview-card {
  background:#FEFFFD;
}

.theme-preview.dark-green {
  background:#0D1202;
}
.theme-preview.dark-green .preview-header {
  background:#141905;
}
.theme-preview.dark-green .preview-card {
  background:#20290b;
}
.preview-header {
  height:30%;
  width:100%;
}
.preview-content {
  padding:8px;
}
.preview-card {
  height:30px;
  border-radius:4px;
}
.theme-name {
  color:var(--text-primary);
  font-size:12px;
  font-weight:500;
}
.about-content,.support-content {
  color:var(--text-secondary);
  font-size:14px;
  line-height:1.5;
}
.about-content p,.support-content p {
  margin-bottom:12px;
}
.about-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.about-link {
  display:inline-flex;
  align-items:center;
  gap:6px;
  color:var(--accent-accent);
  text-decoration:none;
  font-weight:500;
  transition:color 0.2s;
  padding: 4px 0;
}

.about-link:hover {
  color:var(--accent-secondary);
}
.support-buttons {
  display:flex;
  gap:8px;
  margin-top:12px;
}
.support-button {
  flex:1;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  padding:8px;
  background:var(--accent-15);
  color:var(--text-primary);
  text-decoration:none;
  border-radius:8px;
  font-weight:500;
  transition:all 0.2s;
}
.support-button:hover {
  background:var(--accent-accent);
  color:var(--button-secondaryFill);
}
.popup-footer {
  text-align:center;
  margin-top:16px;
}
.version-info {
  color:var(--text-secondary);
  font-size:12px;
  text-align:center;
}

.material-icons-round {
  font-size:18px;
  vertical-align:middle;
}

.custom-themes-section {
  margin-top: 16px;
}

.custom-themes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.custom-themes-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: var(--accent-15);
  color: var(--accent-accent);
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-btn:hover {
  background: var(--accent-accent);
  color: var(--button-secondaryFill);
}

.custom-themes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  min-height: 50px;
}

.custom-theme-option {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--button-secondaryFill);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-border, var(--text-teritary));
  transition: all 0.2s ease;
}

.custom-theme-option:hover {
  border-color: var(--accent-accent);
  transform: translateY(-2px);
}

.custom-theme-option.active {
  border-color: var(--accent-accent);
  box-shadow: 0 0 0 2px var(--accent-15);
}

.custom-theme-option .theme-preview {
  height: 70px;
  border-radius: 0;
}

.custom-theme-option .theme-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--button-secondaryFill);
  border-top: 1px solid var(--border-border, var(--text-teritary));
  gap: 8px;
}

.custom-theme-option .theme-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.custom-theme-option .theme-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.theme-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: var(--accent-15);
  color: var(--accent-accent);
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-action-btn:hover {
  background: var(--accent-accent);
  color: var(--button-secondaryFill);
}

.theme-action-btn.delete-theme {
  background: rgba(255, 80, 80, 0.15);
  color: #ff5050;
}

.theme-action-btn.delete-theme:hover {
  background: #ff5050;
  color: white;
}

.theme-action-btn .material-icons-round {
  font-size: 16px;
}

.no-custom-themes {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 20px 0;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--card-card);
  border-radius: 20px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border-border, var(--text-teritary));
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border-border, var(--text-teritary));
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: var(--button-secondaryFill);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-close:hover {
  background: var(--error-15);
  color: var(--error-accent);
  transform: rotate(90deg);
}

.modal-close .material-icons-round {
  font-size: 20px;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--border-border, var(--text-teritary));
}

.modal-footer button {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Montserrat", serif;
}

.btn-primary {
  background: var(--accent-accent);
  color: #000;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  background: var(--button-secondaryFill);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--accent-15);
}

.theme-form .form-group {
  margin-bottom: 16px;
}

.theme-form label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.theme-form input[type="text"] {
  width: 150px;
  padding: 10px 12px;
  border: 1px solid var(--border-border, var(--text-teritary));
  border-radius: 8px;
  background: var(--button-secondaryFill);
  color: var(--text-primary);
  font-size: 14px;
  font-family: "Montserrat", serif;
  outline: none;
  transition: border-color 0.2s ease;
}

.theme-form input[type="text"]:focus {
  border-color: var(--accent-accent);
}

.mode-selector {
  display: flex;
  gap: 8px;
}

.mode-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border-border, var(--text-teritary));
  border-radius: 8px;
  background: var(--button-secondaryFill);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Montserrat", serif;
  font-size: 13px;
}

.mode-option:hover {
  border-color: var(--accent-accent);
}

.mode-option.active {
  background: var(--accent-15);
  border-color: var(--accent-accent);
  color: var(--accent-accent);
}

.color-section {
  margin-top: 20px;
}

.color-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 12px 0;
}

.color-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}

.color-group label {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

.color-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-input-wrapper input[type="color"] {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  background: transparent;
  flex-shrink: 0;
  border: 1px solid var(--border-border, var(--text-teritary));
}

.color-input-wrapper input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-input-wrapper input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
}

.color-hex {
  width: 72px;
  padding: 6px 8px;
  border: 1px solid var(--border-border, var(--text-teritary));
  border-radius: 6px;
  background: var(--button-secondaryFill);
  color: var(--text-primary);
  font-size: 11px;
  font-family: monospace;
  text-transform: uppercase;
  flex-shrink: 0;
}

.theme-preview-section {
  margin-top: 20px;
}

.theme-preview-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 12px 0;
}

.live-preview {
  width: 100%;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.live-preview .preview-header {
  height: 30%;
  width: 100%;
}

.live-preview .preview-content {
  padding: 8px;
}

.live-preview .preview-card {
  height: 20px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.live-preview .preview-text {
  font-size: 10px;
}

.share-code-wrapper {
  position: relative;
  margin-top: 12px;
}

.share-code-wrapper textarea,
#importCode {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 1px solid var(--border-border, var(--text-teritary));
  border-radius: 8px;
  background: var(--button-secondaryFill);
  color: var(--text-primary);
  font-family: monospace;
  font-size: 12px;
  resize: none;
  outline: none;
}

.share-code-wrapper textarea:focus,
#importCode:focus {
  border-color: var(--accent-accent);
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: var(--accent-15);
  color: var(--accent-accent);
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  background: var(--accent-accent);
  color: var(--button-secondaryFill);
}

.copy-btn.copied {
  background: var(--grades-4);
  color: white;
}

.error-message {
  color: var(--error-accent);
  font-size: 12px;
  margin-top: 8px;
  min-height: 16px;
}

.import-modal .modal-body p {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 8px;
}

#importCode {
  margin-top: 8px;
}
