:root {
	--bg-color: #f8f8f8;
	--text-color: #333;
	--link-color: #555;
	--link-hover-color: #000;
	--border-color: #e0e0e0;
	--search-bg-color: #fff;
	--active-bg-color: #eee;
	--description-color: #888;
	--divider-text-color: #999;
	--divider-line-color: #e0e0e0;
	--modal-bg: white;
	--modal-input-bg: white;
	--modal-input-border: #ccc;
	--modal-info-text-color: #666;
	--fab-bg: #ffffff;
	--fab-color: #000;
	--fab-menu-item-border: #eee;
	--custom-alert-bg: #fff;
	--custom-alert-message-color: #333;
	--placeholder-color: #bbb;
	--logo-color: #bbb;
	--search-button-bg: #f0f0f0;
	--search-button-hover-bg: #ddd;
	--search-button-hover-border: #ccc;
	--suggestion-item-border: #f0f0f0;
	--suggestion-item-hover-bg: #f8f8f8;
	--footer-color: #888;
	--footer-border: #e0e0e0;
}

html.dark-mode {
	--bg-color: #121212;
	--text-color: #e0e0e0;
	--link-color: #bbbbbb;
	--link-hover-color: #888888;
	--border-color: #3a3a3a;
	--search-bg-color: #1e1e1e;
	--active-bg-color: #2a2a2a;
	--description-color: #888;
	--divider-text-color: #888;
	--divider-line-color: #3a3a3a;
	--modal-bg: #2c2c2c;
	--modal-input-bg: #1e1e1e;
	--modal-input-border: #4a4a4a;
	--modal-info-text-color: #aaa;
	--fab-bg: #2c2c2c;
	--fab-color: #e0e0e0;
	--fab-menu-item-border: #3a3a3a;
	--custom-alert-bg: #2c2c2c;
	--custom-alert-message-color: #e0e0e0;
	--placeholder-color: #777;
	--logo-color: #555;
	--search-button-bg: #2c2c2c;
	--search-button-hover-bg: #3a3a3a;
	--search-button-hover-border: #4a4a4a;
	--suggestion-item-border: #3a3a3a;
	--suggestion-item-hover-bg: #2a2a2a;
	--footer-color: #888;
	--footer-border: #3a3a3a;
}

html {
	height: 100%;
}

body {
	font-family: system-ui, sans-serif;
	background-color: var(--bg-color);
	color: var(--text-color);
	margin: 0;
	font-size: 14px;
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

main {
	flex-grow: 1;
	padding: 10px 0 60px;
}

a {
	text-decoration: none;
	color: var(--link-color);
}

.container {
	max-width: 1050px;
	margin: 0 auto;
	text-align: center;
	padding: 0 20px;
}

.header-svg {
    height: 80px;
    width: auto;
    margin-top: 30px;
    margin-bottom: 10px;
}

.logo {
	font-family: 'Courier New', Courier, monospace;
	font-size: 60px;
	color: var(--logo-color);
	margin: 0 0 30px 0;
	font-weight: normal;
	transition: color 0.3s;
}

.search-wrapper {
	margin: 0 auto 60px auto;
	max-width: 750px;
	position: relative;
}

.search-form {
	display: flex;
	border: 1px solid var(--border-color);
	border-radius: 50px;
	overflow: hidden;
	background-color: var(--search-bg-color);
}

.search-input {
	flex-grow: 1;
	border: none;
	padding: 12px 15px;
	font-size: 16px;
	outline: none;
	background: transparent;
	color: var(--text-color);
}

.search-buttons {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 20px;
	margin-top: 20px;
	padding-left: 60px;
	padding-right: 60px;
}

.search-buttons > * {
	flex: 1;
	min-width: 100px;
	max-width: 160px;
}

.search-buttons button {
	background-color: var(--search-button-bg);
	border: 1px solid var(--border-color);
	padding: 10px 10px;
	cursor: pointer;
	border-radius: 20px;
	color: var(--link-color);
	font-size: 15px;
	font-weight: bold;
	transition: all 0.2s ease;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	text-align: center;
}

.search-buttons button:hover {
	background-color: var(--search-button-hover-bg);
	border-color: var(--search-button-hover-border);
}

@media (max-width: 768px) {
	.search-buttons {
		gap: 5px;
		padding-left: 0px;
		padding-right: 0px;
	}

	.search-buttons > * {
		flex-basis: calc(33.33% - 10px);
	}
}

.links-container {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 12px;
	text-align: left;
	background-color: var(--search-bg-color);
	border: 1px solid var(--border-color);
	padding: 20px;
	border-radius: 8px;
}

.grid-item-wrapper.sortable-item, .links-divider.sortable-item {
	cursor: grab;
}

.sortable-ghost {
	background: #f0f7ff;
	border: 2px dashed #a0cfff;
	opacity: 0.7;
}

.grid-item-wrapper {
	position: relative;
	display: flex;
}

.link-item {
	padding: 8px 12px;
	border: 1px solid var(--border-color);
	border-radius: 8px;
	transition: box-shadow 0.2s;
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 6px;
	box-sizing: border-box;
	width: 100%;
	overflow: hidden;
}

.link-item:hover {
	box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.favicon {
	width: 20px;
	height: 20px;
	flex-shrink: 0;
	object-fit: contain;
}

.link-text-content {
	display: flex;
	flex-direction: column;
    justify-content: center; /* 垂直居中 */
	overflow: hidden;
	text-align: center; /* 水平居中 */
    flex-grow: 1; /* 占据剩余空间 */
    align-self: stretch; /* 确保自身高度撑满父容器 */
}


.admin-actions {
	position: absolute;
	top: -10px;
	right: -8px;
	display: flex;
	gap: 3px;
	z-index: 10;
	opacity: 0;
	transition: opacity 0.2s;
}

.grid-item-wrapper:hover .admin-actions {
	opacity: 1;
}

.divider-admin-actions {
	position: absolute;
	display: flex;
	gap: 3px;
	background-color: rgba(248, 248, 248, 0.8);
	border-radius: 5px;
	padding: 2px;
	z-index: 5;
	opacity: 0;
	transition: opacity 0.2s;
}
html.dark-mode .divider-admin-actions {
	background-color: rgba(30, 30, 30, 0.8);
}

.links-divider:hover .divider-admin-actions {
	opacity: 1;
}

.link-name {
	display: block;
	font-weight: bold;
	color: var(--link-hover-color);
	font-size: 15px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	margin-bottom: 2px;
}

.link-description {
	font-size: 12px;
	color: var(--description-color);
	line-height: 1.4;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}


.admin-btn {
	color: white;
	border: none;
	border-radius: 5px;
	width: 22px;
	height: 22px;
	font-size: 16px;
	line-height: 22px;
	text-align: center;
	cursor: pointer;
	transition: transform 0.2s;
	font-weight: bold;
	box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.admin-btn:hover {
	transform: scale(1.1);
}

.edit-btn {
	background-color: #0026a3;
}

.delete-btn {
	background-color: #ff4d4d;
	font-size: 18px;
}

.footer {
	padding: 20px;
	color: var(--footer-color);
	text-align: center;
	font-size: 14px;
	border-top: 1px solid var(--footer-border);
	flex-shrink: 0;
}

.footer a {
	color: var(--footer-color);
	text-decoration: none;
}

.footer a:hover {
	text-decoration: underline;
}

.links-divider {
	grid-column: 1 / -1;
	display: flex;
	align-items: center;
	color: var(--divider-text-color);
	margin: 15px 0;
	position: relative;
	padding: 0 50px;
	box-sizing: border-box;
}

.links-divider-title {
	padding: 0 1em;
	font-size: 14px;
	font-weight: bold;
	white-space: nowrap;
	text-align: center;
	flex-shrink: 0;
}

.links-divider::before, .links-divider::after {
	content: '';
	flex: 1;
	border-bottom: 1px solid var(--divider-line-color);
}

.divider-admin-actions.left {
	left: 0;
}

.divider-admin-actions.right {
	right: 0;
}

#suggestions-container {
	position: absolute;
	background-color: var(--search-bg-color);
	border: 1px solid var(--border-color);
	border-top: none;
	border-radius: 0 0 10px 10px;
	width: 100%;
	max-width: 750px;
	box-sizing: border-box;
	z-index: 100;
	text-align: left;
	display: none;
	margin-left: auto;
	margin-right: auto;
	left: 0;
	right: 0;
	overflow: hidden;
}

.suggestion-item {
	padding: 10px 15px;
	font-size: 15px;
	cursor: pointer;
	border-top: 1px solid var(--suggestion-item-border);
	color: var(--text-color);
}

.suggestion-item:first-child {
	border-top: none;
}

.suggestion-item:hover {
	background-color: var(--suggestion-item-hover-bg);
}

#auto-save-status {
	position: fixed;
	bottom: 20px;
	left: 50%;
	transform: translateX(-50%);
	background-color: #323232;
	color: white;
	padding: 12px 20px;
	border-radius: 5px;
	z-index: 3000;
	opacity: 0;
	transition: opacity 0.5s, transform 0.5s;
	pointer-events: none;
}

#auto-save-status.visible {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

.modal-backdrop {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0,0,0,0.5);
	z-index: 2000;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.3s;
	pointer-events: none;
}

.modal-backdrop.visible {
	opacity: 1;
	pointer-events: auto;
}

.modal-content {
	background-color: var(--modal-bg);
	padding: 25px;
	border-radius: 8px;
	box-shadow: 0 5px 15px rgba(0,0,0,0.3);
	width: 90%;
	max-width: 500px;
	transform: scale(0.95);
	transition: transform 0.3s, background-color 0.3s;
}

.modal-backdrop.visible .modal-content {
	transform: scale(1);
}

#modal-title {
	margin-top: 0;
	margin-bottom: 20px;
	font-size: 20px;
	color: var(--text-color);
}

#modal-form .form-group {
	display: flex;
	flex-direction: column;
	gap: 15px;
	margin-bottom: 20px;
	text-align: left;
}

#modal-form .form-group-inline {
	text-align: left;
	margin-bottom: 15px;
}

#modal-form .form-group-inline label {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
}

.modal-info-text {
	font-size: 14px;
	color: var(--modal-info-text-color);
	margin-top: 0;
	text-align: left;
}

.modal-extra-link {
	text-align: right;
	margin-top: -10px;
	margin-bottom: 15px;
}

.modal-extra-link a {
	font-size: 14px;
	color: #0026a3;
	cursor: pointer;
	text-decoration: none;
}

.modal-extra-link a:hover {
	text-decoration: underline;
}

#modal-form .form-group input {
	width: 100%;
	box-sizing: border-box;
	padding: 10px;
	border: 1px solid var(--modal-input-border);
	background-color: var(--modal-input-bg);
	color: var(--text-color);
	border-radius: 4px;
	font-size: 16px;
}

#modal-form .code-group {
	display: flex;
	gap: 10px;
}

#modal-form .code-group input {
	flex-grow: 1;
}

#modal-form .code-group button {
	flex-shrink: 0;
	padding: 0 15px;
}

#modal-form .password-group input:not(:last-child) {
	margin-bottom: 15px;
}

#modal-form .form-buttons {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
}

#modal-form button {
	padding: 10px 20px;
	border-radius: 5px;
	border: none;
	cursor: pointer;
	font-size: 15px;
}

#modal-form .submit-btn {
	background-image: linear-gradient(320deg, rgb(3, 77, 146), rgb(0, 60, 255));
    background-color: transparent;
	color: white;
}

#modal-form .cancel-btn {
	background-color: #6c757d;
	color: white;
}

.add-buttons-wrapper {
	grid-column: 1 / -1;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 20px;
	margin: 10px 0;
	padding-top: 10px;
}

.add-item-btn {
	border: 1px dashed var(--border-color);
	background: none;
	color: var(--description-color);
	padding: 8px 15px;
	border-radius: 5px;
	cursor: pointer;
	transition: all 0.2s;
}

.add-item-btn:hover {
	background-color: var(--active-bg-color);
	color: var(--text-color);
	border-style: solid;
}

.view-mode .admin-actions,
.view-mode .divider-admin-actions,
.view-mode .add-buttons-wrapper {
	display: none !important;
}

.view-mode .grid-item-wrapper,
.view-mode .links-divider {
	cursor: default;
}

.fab-container {
	position: fixed;
	bottom: 30px;
	right: 30px;
	z-index: 1000;
	display: flex;
	justify-content: center;
	align-items: center;
}

.fab-button {
	position: relative;
	background: var(--fab-bg);
	color: var(--fab-color);
	padding: 0;
	margin: 0;
	border-radius: 10px;
	width: 50px;
	height: 50px;
	font-size: 17px;
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: column;
	box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);
	cursor: pointer;
	transition: all 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
	border: none;
}

.fab-icon {
	font-size: 24px;
	transition: color 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.fab-tooltip {
	position: absolute;
	top: 0px;
	font-size: 14px;
	background: #ffffff;
	color: #ffffff;
	padding: 5px 8px;
	border-radius: 5px;
	box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);
	opacity: 0;
	pointer-events: none;
	transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
	width: 100px;
	text-align: center;
	left: 50%;
	transform: translateX(-50%);
}

.fab-tooltip::before {
	position: absolute;
	content: "";
	height: 8px;
	width: 8px;
	background: #ffffff;
	bottom: -3px;
	left: 50%;
	transform: translate(-50%) rotate(45deg);
	transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.fab-container:hover .fab-tooltip {
	top: -45px;
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.fab-container:hover .fab-button,
.fab-container:hover .fab-tooltip::before {
	background: linear-gradient(320deg, rgb(3, 77, 146), rgb(0, 60, 255));
	color: #ffffff;
}

.fab-container.open .fab-button {
	transform: rotate(45deg);
}

.fab-menu {
	position: absolute;
	bottom: 65px;
	right: 0;
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px);
	transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
}

.fab-container.open .fab-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.fab-menu-item {
	display: block;
	padding: 10px 20px;
	background-color: var(--fab-bg);
	color: var(--text-color);
	border-radius: 8px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.15);
	cursor: pointer;
	text-align: center;
	white-space: nowrap;
	border: 1px solid var(--fab-menu-item-border);
	font-size: 15px;
	transition: background-color 0.2s, color 0.2s;
}

.fab-menu-item:hover {
	background-image: linear-gradient(320deg, rgb(3, 77, 146), rgb(0, 60, 255));
    background-color: transparent;
    color: white;
}

.fab-guest-container {
	position: fixed;
	bottom: 30px;
	right: 30px;
	z-index: 1000;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.fab-guest-btn {
	position: relative;
	background: #ffffff;
	color: #000;
	padding: 15px;
	margin: 0;
	border-radius: 10px;
	width: 80px;
	height: 40px;
	font-size: 18px;
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: column;
	box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);
	cursor: pointer;
	transition: all 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
	border: none;
	box-sizing: border-box;
}

.guest-tooltip {
	position: absolute;
	left: -10px;
	top: -10px;
	font-size: 14px;
	background: #AAA;
	color: #ffffff;
	padding: 5px 8px;
	border-radius: 5px;
	box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);
	opacity: 0;
	pointer-events: none;
	transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
	white-space: nowrap;
	transform: translateX(-100%);
}

.guest-tooltip::before {
	position: absolute;
	content: "";
	height: 8px;
	width: 8px;
	right: -3px;
	top: 50%;
	transform: translateY(-50%) rotate(45deg);
	transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.fab-guest-btn:hover .guest-tooltip {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.fab-guest-btn .btn-text {
	transition: all 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.fab-guest-btn:hover .btn-text,
.fab-guest-btn:hover .guest-tooltip {
	text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.1);
}

.fab-guest-btn:hover,
.fab-guest-btn:hover .guest-tooltip,
.fab-guest-btn:hover .guest-tooltip::before {
	background: linear-gradient(320deg, rgb(3, 77, 146), rgb(0, 60, 255));
	color: #ffffff;
}

#custom-alert-backdrop {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0,0,0,0.4);
	z-index: 4000;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.2s;
	pointer-events: none;
}

#custom-alert-backdrop.visible {
	opacity: 1;
	pointer-events: auto;
}

.custom-alert-box {
	background: var(--custom-alert-bg);
	padding: 25px;
	border-radius: 8px;
	box-shadow: 0 5px 20px rgba(0,0,0,0.25);
	width: 90%;
	max-width: 400px;
	text-align: center;
	transform: scale(0.9);
	transition: transform 0.2s, background-color 0.3s;
}

#custom-alert-backdrop.visible .custom-alert-box {
	transform: scale(1);
}

.custom-alert-message {
	font-size: 16px;
	line-height: 1.6;
	color: var(--custom-alert-message-color);
	margin: 0;
	margin-bottom: 25px;
	word-wrap: break-word;
}

.custom-alert-buttons {
	display: flex;
	justify-content: center;
	gap: 15px;
}

.custom-alert-button {
	padding: 10px 25px;
	border-radius: 5px;
	border: none;
	cursor: pointer;
	font-size: 15px;
	font-weight: 500;
}

.custom-alert-button.primary {
	background-color: #0026a3;
	color: white;
}

.custom-alert-button.secondary {
	background-color: #6c757d;
	color: white;
}

#search::placeholder {
  color: var(--placeholder-color) !important;
  opacity: 1;
}

#search:-ms-input-placeholder {
  color: var(--placeholder-color) !important;
}

#search::-ms-input-placeholder {
  color: var(--placeholder-color) !important;
}

.custom-checkbox {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  color: var(--text-color);
  transition: color 0.3s;
}

.custom-checkbox input[type="checkbox"] {
  display: none;
}

.custom-checkbox .checkmark {
  width: 14px;
  height: 14px;
  border: 2px solid var(--text-color);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 2px;
  transition: background-color 0.3s, border-color 0.3s, transform 0.3s;
  transform-style: preserve-3d;
}

.custom-checkbox .checkmark::before {
  content: "\2714";
  font-size: 14px;
  color: transparent;
  transition: color 0.3s, transform 0.3s;
}

.custom-checkbox input[type="checkbox"]:checked + .checkmark {
  background-color: var(--text-color);
  border-color: var(--text-color);
  transform: scale(1.1) rotateZ(360deg) rotateY(360deg);
}

.custom-checkbox input[type="checkbox"]:checked + .checkmark::before {
  color: var(--bg-color);
}

.custom-checkbox:hover {
  color: #666;
}
html.dark-mode .custom-checkbox:hover {
	color: #aaa;
}


.custom-checkbox:hover .checkmark {
  border-color: #666;
  background-color: #f0f0f0;
  transform: scale(1.05);
}
html.dark-mode .custom-checkbox:hover .checkmark {
	border-color: #aaa;
	background-color: #333;
}

.custom-checkbox input[type="checkbox"]:focus-visible + .checkmark {
  box-shadow: 0 0 3px 2px rgba(0, 123, 255, 0.4);
  outline: none;
}

.custom-checkbox .checkmark,
.custom-checkbox input[type="checkbox"]:checked + .checkmark {
  transition: background-color 1.3s, border-color 1.3s, color 1.3s, transform 0.3s;
}

.theme-toggle-btn {
	position: fixed;
	top: 20px;
	right: 20px;
	z-index: 2001;
	background-color: var(--search-bg-color);
	color: var(--text-color);
	border: 1px solid var(--border-color);
	border-radius: 50%;
	width: 30px;
	height: 30px;
	font-size: 15px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.3s, color 0.3s, transform 0.2s;
}

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